From e4a701377f16f4931286c5b634a71806c707987b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dieter=20Werthm=C3=BCller?= Date: Fri, 10 Jan 2025 12:09:57 +0100 Subject: [PATCH] Deal with new discretize warning --- .github/workflows/linux.yml | 4 ++-- pyproject.toml | 1 + tests/test_electrodes.py | 1 + tests/test_simulations.py | 7 ++++++- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index e9b95b05..933c5666 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -47,7 +47,7 @@ jobs: - python-version: "3.11" name: full os: ubuntu - conda: "scipy numba 'empymod>=2.3.2' xarray tqdm h5py discretize matplotlib" + conda: "scipy numba 'empymod>=2.3.2' xarray tqdm h5py 'discretize>=0.11' matplotlib" - python-version: "3.12" name: plain os: ubuntu @@ -55,7 +55,7 @@ jobs: - python-version: "3.12" name: full os: ubuntu - conda: "scipy numba 'empymod>=2.3.2' xarray tqdm h5py discretize matplotlib" + conda: "scipy numba 'empymod>=2.3.2' xarray tqdm h5py 'discretize>=0.11' matplotlib" env: # Used for coveralls flag diff --git a/pyproject.toml b/pyproject.toml index 8e4c1d2a..b892f279 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,6 +55,7 @@ docs = [ ] tests = [ "flake8", + "discretize>=0.11", "pytest", "coveralls", "pytest_cov", diff --git a/tests/test_electrodes.py b/tests/test_electrodes.py index d0a5e06c..4acbbacc 100644 --- a/tests/test_electrodes.py +++ b/tests/test_electrodes.py @@ -606,6 +606,7 @@ def adj(v): shape_u=mesh.n_edges, shape_v=1, complex_u=rng.choice([True, False]), # Random float or complex. complex_v=rng.choice([True, False]), # Random float or complex. + random_seed=rng, ) diff --git a/tests/test_simulations.py b/tests/test_simulations.py index 9fe58ace..9eaf4365 100644 --- a/tests/test_simulations.py +++ b/tests/test_simulations.py @@ -887,6 +887,7 @@ def test_adjoint(self, tmpdir): sim.jtvec, self.mesh.shape_cells, self.survey.shape, + random_seed=rng, ) sim = simulations.Simulation( @@ -900,6 +901,7 @@ def test_adjoint(self, tmpdir): sim.jtvec, self.mesh.shape_cells, self.survey.shape, + random_seed=rng, ) @pytest.mark.skipif(discretize is None, reason="discretize not installed.") @@ -920,6 +922,7 @@ def test_adjoint_hti(self): sim.jtvec, (2, *self.mesh.shape_cells), self.survey.shape, + random_seed=rng, ) @pytest.mark.skipif(discretize is None, reason="discretize not installed.") @@ -940,6 +943,7 @@ def test_adjoint_vti(self): sim.jtvec, (2, *self.mesh.shape_cells), self.survey.shape, + random_seed=rng, ) @pytest.mark.skipif(discretize is None, reason="discretize not installed.") @@ -961,6 +965,7 @@ def test_adjoint_triaxial(self): sim.jtvec, (3, *self.mesh.shape_cells), self.survey.shape, + random_seed=rng, ) @pytest.mark.skipif(discretize is None, reason="discretize not installed.") @@ -986,7 +991,7 @@ def func1(x): return sim.data.synthetic.data, func2 assert discretize.tests.check_derivative( - func1, m0, plotIt=False, num=3, + func1, m0, plotIt=False, num=3, random_seed=rng, ) @pytest.mark.skipif(discretize is None, reason="discretize not installed.")