From 7ee2a0892beeac9a4a89b37443361f6d2165ee8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ezequiel=20P=C3=A1ssaro?= Date: Tue, 22 Dec 2020 14:16:24 -0300 Subject: [PATCH] fix tests with --generate-reference flag --- tardis/montecarlo/tests/test_spectrum.py | 10 ---------- tardis/plasma/tests/test_complete_plasmas.py | 2 +- tardis/simulation/tests/test_simulation.py | 6 +++--- tardis/tests/test_tardis_full.py | 2 +- 4 files changed, 5 insertions(+), 15 deletions(-) diff --git a/tardis/montecarlo/tests/test_spectrum.py b/tardis/montecarlo/tests/test_spectrum.py index f2236e4ebd4..3b731935f78 100644 --- a/tardis/montecarlo/tests/test_spectrum.py +++ b/tardis/montecarlo/tests/test_spectrum.py @@ -68,11 +68,6 @@ def test_luminosity_density_lambda(spectrum): def test_flux_nu(spectrum): if getattr(spectrum, "distance", None): - if pytest.__version__ < "2.8": - pytest.xfail( - reason="requires pytest.warns (introduced in pytest v2.8)", - ) - with pytest.warns(DeprecationWarning): test_helper.assert_quantity_allclose( spectrum.flux_nu, @@ -88,11 +83,6 @@ def test_flux_nu(spectrum): def test_flux_lambda(spectrum): if getattr(spectrum, "distance", None): - if pytest.__version__ < "2.8": - pytest.xfail( - reason="requires pytest.warns (introduced in pytest v2.8)", - ) - with pytest.warns(DeprecationWarning): test_helper.assert_quantity_allclose( spectrum.flux_lambda, diff --git a/tardis/plasma/tests/test_complete_plasmas.py b/tardis/plasma/tests/test_complete_plasmas.py index 5a4556e7ecb..d90942318e2 100644 --- a/tardis/plasma/tests/test_complete_plasmas.py +++ b/tardis/plasma/tests/test_complete_plasmas.py @@ -161,7 +161,7 @@ def plasma(self, request, chianti_he_db_fpath, config, tardis_ref_data): config["atom_data"] = chianti_he_db_fpath sim = Simulation.from_config(config) if request.config.getoption("--generate-reference"): - sim.plasma.to_hdf(tardis_ref_data, path=config.plasma.save_path) + sim.plasma.to_hdf(tardis_ref_data, path=config.plasma.save_path, overwrite=True) pytest.skip("Reference data saved at {0}".format(tardis_ref_data)) return sim.plasma diff --git a/tardis/simulation/tests/test_simulation.py b/tardis/simulation/tests/test_simulation.py index 2f963287285..8f9f889e99d 100644 --- a/tardis/simulation/tests/test_simulation.py +++ b/tardis/simulation/tests/test_simulation.py @@ -53,9 +53,9 @@ def simulation_one_loop( "output_nu", "output_energy", ] - simulation.to_hdf(tardis_ref_data, "", "test_simulation") - simulation.model.to_hdf(tardis_ref_data, "", "test_simulation") - simulation.runner.to_hdf(tardis_ref_data, "", "test_simulation") + simulation.to_hdf(tardis_ref_data, "", "test_simulation", overwrite=True) + simulation.model.to_hdf(tardis_ref_data, "", "test_simulation", overwrite=True) + simulation.runner.to_hdf(tardis_ref_data, "", "test_simulation", overwrite=True) pytest.skip("Reference data was generated during this run.") diff --git a/tardis/tests/test_tardis_full.py b/tardis/tests/test_tardis_full.py index 066b1a6bc00..8666679df2a 100644 --- a/tardis/tests/test_tardis_full.py +++ b/tardis/tests/test_tardis_full.py @@ -34,7 +34,7 @@ def runner(self, atomic_data_fname, tardis_ref_data, generate_reference): "spectrum", "spectrum_virtual", ] - simulation.runner.to_hdf(tardis_ref_data, "", self.name) + simulation.runner.to_hdf(tardis_ref_data, "", self.name, overwrite=True) pytest.skip("Reference data was generated during this run.") @pytest.fixture(scope="class")