Skip to content
Merged
Show file tree
Hide file tree
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
14 changes: 7 additions & 7 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from mpi4py import MPI


@pytest.fixture(autouse=True, scope="session")
@pytest.fixture(autouse=True, scope="function")
def amrex_init():
amrex.initialize(
[
Expand All @@ -29,21 +29,21 @@ def amrex_init():
amrex.finalize()


@pytest.fixture(scope="module")
@pytest.fixture(scope="function")
def std_real_box():
"""Standard RealBox for common problem domains"""
rb = amrex.RealBox(0, 0, 0, 1.0, 1.0, 1.0)
return rb


@pytest.fixture(scope="module")
@pytest.fixture(scope="function")
def std_box():
"""Standard Box for tests"""
bx = amrex.Box(amrex.IntVect(0, 0, 0), amrex.IntVect(63, 63, 63))
return bx


@pytest.fixture(scope="module")
@pytest.fixture(scope="function")
def std_geometry(std_box, std_real_box):
"""Standard Geometry"""
coord = 1 # RZ
Expand All @@ -52,22 +52,22 @@ def std_geometry(std_box, std_real_box):
return gm


@pytest.fixture(scope="module")
@pytest.fixture(scope="function")
def boxarr(std_box):
"""BoxArray for MultiFab creation"""
ba = amrex.BoxArray(std_box)
ba.max_size(32)
return ba


@pytest.fixture(scope="module")
@pytest.fixture(scope="function")
def distmap(boxarr):
"""DistributionMapping for MultiFab creation"""
dm = amrex.DistributionMapping(boxarr)
return dm


@pytest.fixture(params=list(itertools.product([1, 3], [0, 1])))
@pytest.fixture(scope="function", params=list(itertools.product([1, 3], [0, 1])))
def mfab(boxarr, distmap, request):
"""MultiFab for tests"""
num_components = request.param[0]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import amrex


@pytest.fixture
@pytest.fixture(scope="function")
def box():
return amrex.Box((0, 0, 0), (127, 127, 127))

Expand Down
6 changes: 3 additions & 3 deletions tests/test_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
# TODO: return coord?


@pytest.fixture
@pytest.fixture(scope="function")
def box():
return amrex.Box(amrex.IntVect(0, 0, 0), amrex.IntVect(127, 127, 127))


@pytest.fixture
@pytest.fixture(scope="function")
def real_box():
return amrex.RealBox([0, 0, 0], [1, 2, 5])


@pytest.fixture
@pytest.fixture(scope="function")
def geometry(box, real_box):
coord = 1
is_periodic = [0, 0, 1]
Expand Down
6 changes: 3 additions & 3 deletions tests/test_particleContainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ def Npart():
return 21


@pytest.fixture()
@pytest.fixture(scope="function")
def empty_particle_container(std_geometry, distmap, boxarr):
pc = amrex.ParticleContainer_1_1_2_1(std_geometry, distmap, boxarr)
return pc


@pytest.fixture()
@pytest.fixture(scope="function")
def std_particle():
myt = amrex.ParticleInitType_1_1_2_1()
myt.real_struct_data = [0.5]
Expand All @@ -27,7 +27,7 @@ def std_particle():
return myt


@pytest.fixture()
@pytest.fixture(scope="function")
def particle_container(Npart, std_geometry, distmap, boxarr, std_real_box):
pc = amrex.ParticleContainer_1_1_2_1(std_geometry, distmap, boxarr)
myt = amrex.ParticleInitType_1_1_2_1()
Expand Down