From a5be0952683ad8e2986d1ad8b16a2622a953900e Mon Sep 17 00:00:00 2001 From: Pauli Virtanen <pauli.t.virtanen@jyu.fi> Date: Wed, 21 Sep 2022 12:30:07 +0300 Subject: [PATCH] tests: fixup --- tests/test_basic.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/test_basic.py b/tests/test_basic.py index 3ef1d58..2a7d4a8 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -85,7 +85,19 @@ def test_result_S_J0(omega, h, terminals): assert_allclose(J, 0, atol=1e-5) -def test_gauge_invariance(): +@pytest.mark.parametrize( + "use_numdifftools", + [ + False, + pytest.param( + True, + marks=pytest.mark.skipif( + numdifftools is None, reason="numdifftools not installed" + ), + ), + ], +) +def test_gauge_invariance(use_numdifftools): nx = 10 ny = 7 h = 0.4 @@ -179,7 +191,7 @@ def test_gauge_invariance(): # They must match assert_allclose(div_J, dS_ds, rtol=1e-6) - if numdifftools is not None: + if use_numdifftools: # More accurate numdiff: the equality should hold to high # numerical accuracy D = numdifftools.Derivative(S_s) -- GitLab