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
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,21 @@


@pytest.fixture(autouse=True, scope="function")
def amrex_init():
amr.initialize(
[
# print AMReX status messages
"amrex.verbose=2",
# throw exceptions and create core dumps instead of
# AMReX backtrace files: allows to attach to
# debuggers
"amrex.throw_exception=1",
"amrex.signal_handling=0",
# abort GPU runs if out-of-memory instead of swapping to host RAM
# "abort_on_out_of_gpu_memory=1",
]
)
def amrex_init(tmpdir):
with tmpdir.as_cwd():
amr.initialize(
[
# print AMReX status messages
"amrex.verbose=2",
# throw exceptions and create core dumps instead of
# AMReX backtrace files: allows to attach to
# debuggers
"amrex.throw_exception=1",
"amrex.signal_handling=0",
# abort GPU runs if out-of-memory instead of swapping to host RAM
# "abort_on_out_of_gpu_memory=1",
]
)
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 😅

ax3l marked this conversation as resolved.
Show resolved Hide resolved

Expand Down
Loading