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

MultiFab: Fix Fixture Lifetime #84

Merged
merged 1 commit into from
Oct 17, 2022

Conversation

ax3l
Copy link
Member

@ax3l ax3l commented Oct 17, 2022

pytest fixtures are cached by default. That's not ideal for us, since we want to clean up and re-init AMReX and its memory arenas between tests that run in the same process.

Thus, we now create a multifab fixture that is just a generator, so that the returned/yielded fixture variable (the generator) can be cached - but the generated MultiFab is actually destroyed as we would expect once each test finishes.

Refs.:

@ax3l ax3l added the bug Something isn't working label Oct 17, 2022
@ax3l ax3l mentioned this pull request Oct 17, 2022
2 tasks
pytest fixtures are cached by default. That's not ideal for us,
since we want to clean up and re-init AMReX and its memory
arenas between tests.

Thus, we now create a multifab fixture that is just a generator,
so that the returned/yielded object can be cached - but the
generated MultiFab is actually destroyed as we would expect once
the test finishes.
@ax3l ax3l enabled auto-merge (squash) October 17, 2022 02:02
@ax3l ax3l merged commit fc9d0ea into AMReX-Codes:development Oct 17, 2022
@ax3l ax3l deleted the fix-mfab-fixture-lifetime branch October 17, 2022 02:14
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.

1 participant