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 all commits
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
37 changes: 21 additions & 16 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-

import itertools
import os

import pytest

Expand All @@ -18,24 +19,28 @@
if amr.Config.have_mpi:
from mpi4py import MPI

# base path for input files
basepath = os.getcwd()


@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",
]
)
yield
amr.finalize()
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()


@pytest.fixture(scope="function")
Expand Down
Loading