Skip to content

Improves our unit test coverage#13

Open
joehakimrahme wants to merge 1 commit into
mena-devs:masterfrom
joehakimrahme:unit_tests
Open

Improves our unit test coverage#13
joehakimrahme wants to merge 1 commit into
mena-devs:masterfrom
joehakimrahme:unit_tests

Conversation

@joehakimrahme

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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