Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improves our unit test coverage #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Improves our unit test coverage #13

wants to merge 1 commit into from

Conversation

joehakimrahme
Copy link
Contributor

Some more unit tests to increase our overall coverage of the script.

Introduces the mock module as a test dependency.
Note that Python3 supports unittest.mock in the standard library.

Some refactoring need to be done in test_load_invalid_config_failure once the PR #10 is merged (As far as I know Github doesn't support dependent PRs so I had to find a temporary solution).

Introduces the `mock` module as a test dependency.
Note that Python3 supports `unittest.mock` in the standard library.
'configured correctly.'.format(config_file))
sys.exit(1)
except yaml.scanner.ScannerError:
self.logger.error(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joehakimrahme wondering why this is done manually here, can't the file loader check for syntax sanity depending on format?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand the question.

If yaml.safe_load is given a file that's not a valid YAML it will throw a yaml.scanner.ScannerError exception. I just think it's best to catch it on the spot and exit the script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants