Skip to content

Commit

Permalink
Merge fa9f0c1 into da5664a
Browse files Browse the repository at this point in the history
  • Loading branch information
wkerzendorf committed Jul 26, 2018
2 parents da5664a + fa9f0c1 commit 35f6bfb
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 30 deletions.
32 changes: 2 additions & 30 deletions tardis/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
except NameError: # Needed to support Astropy <= 1.0.0
pass

DEFAULT_UUID = '864f1753714343c41f99cb065710cace'


# -------------------------------------------------------------------------
# Initialization
Expand Down Expand Up @@ -103,6 +103,7 @@ def tardis_ref_path():
else:
return os.path.expandvars(os.path.expanduser(tardis_ref_path))

from tardis.tests.fixtures.atom_data import *

@pytest.yield_fixture(scope="session")
def tardis_ref_data(tardis_ref_path, generate_reference):
Expand All @@ -119,35 +120,6 @@ def tardis_ref_data(tardis_ref_path, generate_reference):
yield store


@pytest.fixture(scope="session")
def atomic_data_fname(tardis_ref_path):
atomic_data_fname = os.path.join(
tardis_ref_path, 'atom_data', 'kurucz_cd23_chianti_H_He.h5')

assert os.path.exists(atomic_data_fname), ("{0} atomic datafiles"
" does not seem to "
"exist".format(
atomic_data_fname))
return atomic_data_fname


@pytest.fixture(scope="session")
def atomic_dataset(atomic_data_fname):
atomic_data = AtomData.from_hdf(atomic_data_fname)

if atomic_data.md5 != DEFAULT_UUID:
pytest.skip(
'Need default Kurucz atomic dataset (md5="{}"'.format(
DEFAULT_UUID))
else:
return atomic_data


@pytest.fixture
def kurucz_atomic_data(atomic_dataset):
atomic_data = deepcopy(atomic_dataset)
return atomic_data


@pytest.fixture
def tardis_config_verysimple():
Expand Down
Empty file.
39 changes: 39 additions & 0 deletions tardis/tests/fixtures/atom_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import os
from copy import deepcopy

import pytest

from tardis.io.atomic import AtomData

DEFAULT_ATOM_DATA_UUID = '864f1753714343c41f99cb065710cace'

@pytest.fixture(scope="session")
def atomic_data_fname(tardis_ref_path):
atomic_data_fname = os.path.join(
tardis_ref_path, 'atom_data', 'kurucz_cd23_chianti_H_He.h5')

atom_data_missing_str = ("{0} atomic datafiles "
"does not seem to exist".format(atomic_data_fname))

if not os.path.exists(atomic_data_fname):
pytest.exit(atom_data_missing_str)

return atomic_data_fname


@pytest.fixture(scope="session")
def atomic_dataset(atomic_data_fname):
atomic_data = AtomData.from_hdf(atomic_data_fname)

if atomic_data.md5 != DEFAULT_ATOM_DATA_UUID:
pytest.skip(
'Need default Kurucz atomic dataset (md5="{}"'.format(
DEFAULT_ATOM_DATA_UUID))
else:
return atomic_data


@pytest.fixture
def kurucz_atomic_data(atomic_dataset):
atomic_data = deepcopy(atomic_dataset)
return atomic_data

0 comments on commit 35f6bfb

Please sign in to comment.