Skip to content

Commit

Permalink
Tests (#17)
Browse files Browse the repository at this point in the history
* add test branch

* individual loggers per file, better practice

* individual loggers per file, better practice

* fix checkURI test

* remove extra file

* fix typo

* fake args

* improve run tests script

* improve run tests script

* remove git history from docker build

* more image tests

* add some coverage checking

* had to rework logger to get good tests...

* had to rework logger to get good tests...

* stupid errors

* closer

* closer

* fstrings

* commit cause lightning

* yay 37 tests!

* coveragerc

* fix cli reference
  • Loading branch information
circa10a authored Oct 8, 2018
1 parent 0496924 commit e1f5e6c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[run]
omit =
*main.py*
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ __pycache__
.git*
tests/
requirements-dev.txt
*.sh
*.sh
.coveragerc
4 changes: 2 additions & 2 deletions ouroboros/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def checkURI(uri):
regex = re.compile(
r'^(?:tcp)s?://' # tcp://
r'(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)|' #domain...
r'localhost|' #localhost...
r'localhost|' # localhost...
r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})' # ...or ip
r'(?::\d+)?' # optional port
r'(?:/?|[/?]\S+)$', re.IGNORECASE)
Expand All @@ -37,4 +37,4 @@ def parser(sysargs):
monitor = args.monitor or []
level = args.loglevel or 'info'
api_client = docker.APIClient(base_url=host)
return args
#return args
2 changes: 1 addition & 1 deletion ouroboros/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

def check_credentials():
"""Returns dict of credentials if environment variable 'REPO_USER' and 'REPO_PASS' are set"""
if environ.get('REPO_USER') and environ.get('REPO_PASS') is not None:
if environ.get('REPO_USER') and environ.get('REPO_PASS'):
return { 'username': environ['REPO_USER'], 'password': environ['REPO_PASS'] }
return {}

Expand Down
2 changes: 1 addition & 1 deletion ouroboros/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def main():

if __name__ == "__main__":
cli.parser(sys.argv[1:])
logging.basicConfig(**set_logger(cli.loglevel))
logging.basicConfig(**set_logger(cli.level))
schedule.every(cli.interval).seconds.do(main)
while True:
schedule.run_pending()
Expand Down

0 comments on commit e1f5e6c

Please sign in to comment.