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

pytest: Temporary Working Directory #181

Merged
merged 3 commits into from
Aug 30, 2023

Conversation

ax3l
Copy link
Member

@ax3l ax3l commented Aug 28, 2023

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 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.
@ax3l ax3l added the bug Something isn't working label Aug 28, 2023
@ax3l ax3l requested a review from sayerhs August 28, 2023 22:04
Comment on lines 38 to 39
yield
amr.finalize()
Copy link
Contributor

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

Copy link
Member Author

@ax3l ax3l Aug 29, 2023

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 😅

tests/conftest.py Outdated Show resolved Hide resolved
@ax3l
Copy link
Member Author

ax3l commented Aug 29, 2023

Hm, this actually fails my tests in ECP-WarpX/impactx#424 ... maybe because it works now (and cannot find input files)?

@sayerhs
Copy link
Contributor

sayerhs commented Aug 29, 2023

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
```
@ax3l
Copy link
Member Author

ax3l commented Aug 30, 2023

Ah, now managed to pass their path before going into the per-test directory :)

@ax3l ax3l merged commit 304862c into AMReX-Codes:development Aug 30, 2023
15 checks passed
@ax3l ax3l deleted the fix-tmpdir-tests branch August 30, 2023 05:35
@ax3l ax3l mentioned this pull request Oct 20, 2023
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants