-
Notifications
You must be signed in to change notification settings - Fork 19
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
pytest: Temporary Working Directory #181
Conversation
Tests can generate temporary output and directories, which might clash and/or need cleaning between tests. This changes the current working directory to a unique directory per test.
tests/conftest.py
Outdated
yield | ||
amr.finalize() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommend that these two lines are also inside the with
block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was googling about with
context and yield
combinations and got nervous about what I saw 😅
Hm, this actually fails my tests in ECP-WarpX/impactx#424 ... maybe because it works now (and cannot find input files)? |
What is the error? How are you creating the input files? |
Not yet used, can be used in test files as ```py from conftest import basepath ```
Ah, now managed to pass their path before going into the per-test directory :) |
Tests can generate temporary output and directories, which might clash and/or need cleaning between tests.
This changes the current working directory to a unique directory per test.