Skip to content

Commit

Permalink
Fix tests with --generate-reference flag
Browse files Browse the repository at this point in the history
fix tests with --generate-reference flag
  • Loading branch information
andrewfullard authored Jan 8, 2021
2 parents e2243ce + 7ee2a08 commit 9c5e24c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 15 deletions.
10 changes: 0 additions & 10 deletions tardis/montecarlo/tests/test_spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion tardis/plasma/tests/test_complete_plasmas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions tardis/simulation/tests/test_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")


Expand Down
2 changes: 1 addition & 1 deletion tardis/tests/test_tardis_full.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 9c5e24c

Please sign in to comment.