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

Replaced decorator skipUnlessModule #53

Merged
merged 1 commit into from
Jan 3, 2024
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
7 changes: 4 additions & 3 deletions tests/test_droplet_tracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
"""

import numpy as np
import pytest

from pde.grids import UnitGrid
from pde.tools.misc import skipUnlessModule
from pde.tools.misc import module_available

from droplets.droplet_tracks import DropletTrack, DropletTrackList
from droplets.droplets import DiffuseDroplet, SphericalDroplet
Expand Down Expand Up @@ -41,7 +42,7 @@ def test_droplettrack():
assert t1 is not t2


@skipUnlessModule("h5py")
@pytest.mark.skipif(not module_available("h5py"), reason="requires `h5py` module")
def test_droplettrack_io(tmp_path):
"""test writing and reading droplet tracks"""
path = tmp_path / "test_droplettrack_io.hdf5"
Expand Down Expand Up @@ -83,7 +84,7 @@ def test_droplettracklist():
assert len(tl) == 1


@skipUnlessModule("h5py")
@pytest.mark.skipif(not module_available("h5py"), reason="requires `h5py` module")
def test_droplettracklist_io(tmp_path):
"""test writing and reading droplet tracks"""
path = tmp_path / "test_droplettracklist_io.hdf5"
Expand Down
6 changes: 3 additions & 3 deletions tests/test_droplets.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from scipy import integrate

from pde.grids import UnitGrid
from pde.tools.misc import skipUnlessModule
from pde.tools.misc import module_available
from pde.tools.numba import jit

from droplets import droplets
Expand Down Expand Up @@ -207,7 +207,7 @@ def test_from_data():
assert d1 is not d2


@skipUnlessModule("h5py")
@pytest.mark.skipif(not module_available("h5py"), reason="requires `h5py` module")
def test_triangulation_2d():
"""test the 2d triangulation of droplets"""
d1 = droplets.SphericalDroplet([1, 3], 5)
Expand All @@ -221,7 +221,7 @@ def test_triangulation_2d():
assert l == pytest.approx(drop.surface_area, rel=1e-3), drop


@skipUnlessModule("h5py")
@pytest.mark.skipif(not module_available("h5py"), reason="requires `h5py` module")
def test_triangulation_3d():
"""test the 3d triangulation of droplets"""
d1 = droplets.SphericalDroplet([1, 2, 3], 5)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_emulsion.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import pytest

from pde import CartesianGrid, MemoryStorage, ScalarField, UnitGrid
from pde.tools.misc import skipUnlessModule
from pde.tools.misc import module_available

from droplets import DiffuseDroplet, Emulsion, SphericalDroplet, droplets, emulsions
from droplets.emulsions import EmulsionTimeCourse
Expand Down Expand Up @@ -163,7 +163,7 @@ def test_emulsion_linked_data():
np.testing.assert_array_equal(e[1]._data_array, 5)


@skipUnlessModule("h5py")
@pytest.mark.skipif(not module_available("h5py"), reason="requires `h5py` module")
def test_emulsion_io(tmp_path):
"""test writing and reading emulsions"""
path = tmp_path / "test_emulsion_io.hdf5"
Expand Down Expand Up @@ -206,7 +206,7 @@ def test_timecourse():
assert len(t1) == 0


@skipUnlessModule("h5py")
@pytest.mark.skipif(not module_available("h5py"), reason="requires `h5py` module")
def test_timecourse_io(tmp_path):
"""test writing and reading emulsions time courses"""
path = tmp_path / "test_timecourse_io.hdf5"
Expand Down
4 changes: 2 additions & 2 deletions tests/test_trackers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
import pytest

from pde import CahnHilliardPDE, CartesianGrid, DiffusionPDE, ScalarField, UnitGrid
from pde.tools.misc import skipUnlessModule
from pde.tools.misc import module_available

from droplets import LengthScaleTracker, SphericalDroplet
from droplets.emulsions import EmulsionTimeCourse


@skipUnlessModule("h5py")
@pytest.mark.skipif(not module_available("h5py"), reason="requires `h5py` module")
def test_emulsion_tracker(tmp_path):
"""test using the emulsions tracker"""
path = tmp_path / "test_emulsion_tracker.hdf5"
Expand Down
Loading