Skip to content

Commit

Permalink
Rename the mark to test_only_with_numba
Browse files Browse the repository at this point in the history
  • Loading branch information
santisoler committed Oct 25, 2021
1 parent 15a433b commit cf98fa8
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions harmonica/tests/test_eq_sources_cartesian.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
jacobian_numba_serial,
pop_extra_coords,
)
from .utils import run_only_with_numba
from .utils import test_only_with_numba


def test_pop_extra_coords():
Expand All @@ -43,7 +43,7 @@ def test_pop_extra_coords():
assert kwargs == {"bla": 1, "blabla": 2}


@run_only_with_numba
@test_only_with_numba
def test_equivalent_sources_cartesian():
"""
Check that predictions are reasonable when interpolating from one grid to
Expand Down Expand Up @@ -301,7 +301,7 @@ def test_equivalent_sources_jacobian_cartesian():
npt.assert_allclose(jacobian[nearest_neighbours][0], jacobian[nearest_neighbours])


@run_only_with_numba
@test_only_with_numba
def test_equivalent_sources_cartesian_parallel():
"""
Check predictions when parallel is enabled and disabled
Expand Down
6 changes: 3 additions & 3 deletions harmonica/tests/test_eq_sources_spherical.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
import verde as vd

from .. import EquivalentSourcesSph, EQLHarmonicSpherical, point_mass_gravity
from .utils import run_only_with_numba
from .utils import test_only_with_numba


@run_only_with_numba
@test_only_with_numba
def test_equivalent_sources_spherical():
"""
Check that predictions are reasonable when interpolating from one grid to
Expand Down Expand Up @@ -164,7 +164,7 @@ def test_equivalent_sources_spherical_no_projection():
eqs.grid(upward=10, projection=lambda a, b: (a * 2, b * 2))


@run_only_with_numba
@test_only_with_numba
def test_equivalent_sources_spherical_parallel():
"""
Check predictions when parallel is enabled and disabled
Expand Down
6 changes: 3 additions & 3 deletions harmonica/tests/test_point_mass.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from ..forward.point_mass import point_mass_gravity
from ..forward.utils import distance_cartesian

from .utils import run_only_with_numba
from .utils import test_only_with_numba


def test_invalid_coordinate_system():
Expand Down Expand Up @@ -596,7 +596,7 @@ def test_g_easting_sign():
assert np.sign(mass) == -np.sign(results[2])


@run_only_with_numba
@test_only_with_numba
def test_point_mass_cartesian_parallel():
"""
Check if parallel and serial runs return the same result
Expand Down Expand Up @@ -735,7 +735,7 @@ def test_point_mass_potential_on_same_meridian():
)


@run_only_with_numba
@test_only_with_numba
def test_point_mass_spherical_parallel():
"""
Check if parallel and serial runs return the same result
Expand Down
4 changes: 2 additions & 2 deletions harmonica/tests/test_prism.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from ..gravity_corrections import bouguer_correction
from ..forward.prism import prism_gravity, _check_prisms, safe_atan2, safe_log

from .utils import run_only_with_numba
from .utils import test_only_with_numba


def test_invalid_field():
Expand Down Expand Up @@ -363,7 +363,7 @@ def test_prism_against_infinite_slab():
npt.assert_allclose(analytical, results[-1])


@run_only_with_numba
@test_only_with_numba
def test_prisms_parallel_vs_serial():
"""
Check if the parallelized run returns the same results as the serial one
Expand Down
12 changes: 6 additions & 6 deletions harmonica/tests/test_tesseroid.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from verde import grid_coordinates
import boule

from .utils import run_only_with_numba
from .utils import test_only_with_numba
from ..constants import GRAVITATIONAL_CONST
from ..forward.tesseroid import (
tesseroid_gravity,
Expand Down Expand Up @@ -467,7 +467,7 @@ def test_split_tesseroid_only_horizontal():
# ----------------------------
# Test adaptive discretization
# ----------------------------
@run_only_with_numba
@test_only_with_numba
@pytest.mark.parametrize("radial_discretization", [True, False])
def test_adaptive_discretization_on_radii(radial_discretization):
"Test if closer computation points increase the tesseroid discretization"
Expand Down Expand Up @@ -498,7 +498,7 @@ def test_adaptive_discretization_on_radii(radial_discretization):
assert number_of_splits[i - 1] >= number_of_splits[i]


@run_only_with_numba
@test_only_with_numba
@pytest.mark.parametrize("radial_discretization", [True, False])
def test_adaptive_discretization_vs_distance_size_ratio(radial_discretization):
"Test if higher distance-size-ratio increase the tesseroid discretization"
Expand All @@ -522,7 +522,7 @@ def test_adaptive_discretization_vs_distance_size_ratio(radial_discretization):
assert number_of_splits[i - 1] <= number_of_splits[i]


@run_only_with_numba
@test_only_with_numba
def test_two_dimensional_adaptive_discretization():
"""
Test if 2D adaptive discretization produces no splits on radial direction
Expand Down Expand Up @@ -567,7 +567,7 @@ def spherical_shell_analytical(top, bottom, density, radius):
return analytical


@run_only_with_numba
@test_only_with_numba
@pytest.mark.parametrize("field", ["potential", "g_z"])
def test_spherical_shell_two_dim_adaptive_discret(
field,
Expand Down Expand Up @@ -613,7 +613,7 @@ def test_spherical_shell_two_dim_adaptive_discret(
)


@run_only_with_numba
@test_only_with_numba
@pytest.mark.parametrize("field", ["potential", "g_z"])
@pytest.mark.parametrize("thickness", [10, 100, 1e3, 1e4, 1e5])
def test_spherical_shell_three_dim_adaptive_discret(
Expand Down
2 changes: 1 addition & 1 deletion harmonica/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def combination(func):
# ``@pytest.mark.use_numba`` instead. Therefore the test function will be run
# twice: one with Numba jit enabled, and another one with Numba jit disable to
# check coverage.
run_only_with_numba = combine_decorators(
test_only_with_numba = combine_decorators(
pytest.mark.skipif(NUMBA_IS_DISABLED, reason="Numba jit is disabled"),
pytest.mark.use_numba,
)

0 comments on commit cf98fa8

Please sign in to comment.