diff --git a/tardis/conftest.py b/tardis/conftest.py index 1d42ff9d45e..6c0de744eee 100644 --- a/tardis/conftest.py +++ b/tardis/conftest.py @@ -107,7 +107,7 @@ def tardis_ref_path(): @pytest.yield_fixture(scope="session") def tardis_ref_data(tardis_ref_path, generate_reference): if generate_reference: - mode = 'a' + mode = 'w' else: mode = 'r' with pd.HDFStore( diff --git a/tardis/plasma/tests/test_complete_plasmas.py b/tardis/plasma/tests/test_complete_plasmas.py index 192d8b0c119..5f2ffeb1d4e 100644 --- a/tardis/plasma/tests/test_complete_plasmas.py +++ b/tardis/plasma/tests/test_complete_plasmas.py @@ -134,9 +134,16 @@ def config(self, request): return config @pytest.yield_fixture(scope="class") - def reference(self, reference_fpath): - with pd.HDFStore(reference_fpath) as hdf_file: - yield hdf_file + def reference(self, reference_fpath, generate_reference): + if generate_reference: + mode = 'w' + else: + mode = 'r' + with pd.HDFStore( + reference_fpath, + mode=mode + ) as store: + yield store @pytest.fixture(scope="class") def plasma(self, chianti_he_db_fpath, config, reference_fpath, reference):