-
-
Notifications
You must be signed in to change notification settings - Fork 404
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
Use pytest's monkeypatch.chdir to change the working directory in the config_reader tests #555
Conversation
… config_reader tests.
I think you could go even so far as to have one test function and parametrize it. I think you wouldn't need a class in that case. |
@yeganer Checked parametrize, and I think it would probably make sense to only use it for 2 of the 3 functions, since the one with the absolute path has slightly different behaviour (no If you don't insist on using parametrize, I'd say we can merge this @wkerzendorf. |
Actually I'd use parametrize because the functionality is the same in all 3 functions.
something like this. |
@ftsamis can you fix this? |
@wkerzendorf I'm now working on it. Anyhow, I'll use parametrize. |
@yeganer what do you think? |
I think, I'm a bit nitpicking here but you could have the cwd as parameter for your function and then read the config two times, once with a relative path to the destination and once with an absolute path. That should cover everything and you don't have to do if/else in the test. |
That sounds indeed better. Done. |
Thanks, that looks great. |
Following @yeganer's suggestion at #543 (comment) and replacing the custom function in
test_config_reader
, for temporarily changing the working directory in a test, with pytest'smonkeypatch.chdir
.