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

Test if mode is unique #184

Merged
merged 3 commits into from
Aug 31, 2017
Merged

Test if mode is unique #184

merged 3 commits into from
Aug 31, 2017

Conversation

ocefpaf
Copy link
Member

@ocefpaf ocefpaf commented Aug 31, 2017

@lsetiawan ignore this for a while. I am just testing to see if I can get it to fail.

Copy link
Member Author

@ocefpaf ocefpaf left a comment

Choose a reason for hiding this comment

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

@lsetiawan this is ready for review now.
I don't know why Travis-CI recycles the id_node, but the directory is overwritten. Probably some smart disk cache? Dunno...

@@ -89,5 +95,9 @@ def main():
copytree(_CONFIG, _PRODUCTION, overwrite=overwrite)


def main():
args = parse_args()
cli(args)
Copy link
Member Author

Choose a reason for hiding this comment

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

Factoring the cli out of main helps us to create "real user case" tests.

assert os.path.isdir(os.path.join(_directory, 'production_configs'))
args.update({'--mode': 'development'})
cli(args)
assert not os.path.isdir(os.path.join(_directory, 'production_configs'))
Copy link
Member Author

Choose a reason for hiding this comment

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

This sequence of asserts check if an instance created under production mode lost the production_configs when it was overwritten by a second call with development. This is not an ideal test b/c it test a corner case only, but it works on Windows and we can add additional cases later. (For example, a test that modifies the contents of the config files and see if the expected modification are there, or not, when calling the cli).

Copy link
Member

@lsetiawan lsetiawan left a comment

Choose a reason for hiding this comment

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

Looks great @ocefpaf! Thanks for fixing it 👍

@lsetiawan
Copy link
Member

I don't know why Travis-CI recycles the id_node, but the directory is overwritten. Probably some smart disk cache? Dunno...

Wow. So many changes on Travis CI side! I guess it keeps us on our toes 😄

@lsetiawan lsetiawan merged commit ea4186b into ODM2:master Aug 31, 2017
@ocefpaf ocefpaf deleted the test_mode branch August 31, 2017 14:42
@emiliom
Copy link
Member

emiliom commented Aug 31, 2017

Thanks.

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.

3 participants