Skip to content

Commit

Permalink
Modify fixtures for TestW7 to accept from YAML.
Browse files Browse the repository at this point in the history
  • Loading branch information
Karan Desai committed May 31, 2016
1 parent 0b04dcb commit 3d81297
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
6 changes: 3 additions & 3 deletions tardis/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ def pytest_unconfigure(config):
try:
import dokuwiki
doku_conn = dokuwiki.DokuWiki(
url="http://opensupernova.org/~karandesai96/integration2/",
user=config.getvalue("username"),
password=config.getvalue("password"))
url=integration_tests_config["dokuwiki"]["url"],
user=integration_tests_config["dokuwiki"]["username"],
password=integration_tests_config["dokuwiki"]["password"])
dokuwiki_available = True
except:
dokuwiki_available = False
Expand Down
18 changes: 8 additions & 10 deletions tardis/tests/tests_slow/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@


@pytest.fixture(scope="session")
def slow_tests_datadir():
slow_tests_datadir = pytest.config.getvalue("slow-test-data")
if slow_tests_datadir is None:
pytest.skip('--slow-test-data was not specified')
else:
return os.path.expandvars(os.path.expanduser(slow_tests_datadir))
def reference_datadir(integration_tests_config):
return os.path.expandvars(
os.path.expanduser(integration_tests_config["reference"])
)


@pytest.fixture(scope="session")
Expand All @@ -33,7 +31,7 @@ def base_plot_dir():


@pytest.fixture(scope="session")
def reference(request, slow_tests_datadir):
def reference(request, reference_datadir):
"""
Fixture to ingest reference data for slow test from already available
compressed binaries (.npz). All data is collected in one dict and
Expand All @@ -60,9 +58,9 @@ def reference(request, slow_tests_datadir):
"""

# TODO: make this fixture ingest data from an HDF5 file.
ndarrays = dict(np.load(os.path.join(slow_tests_datadir, "ndarrays.npz")))
quantities = dict(np.load(os.path.join(slow_tests_datadir, "quantities.npz")))
spectrum = dict(np.load(os.path.join(slow_tests_datadir, "spectrum.npz")))
ndarrays = dict(np.load(os.path.join(reference_datadir, "ndarrays.npz")))
quantities = dict(np.load(os.path.join(reference_datadir, "quantities.npz")))
spectrum = dict(np.load(os.path.join(reference_datadir, "spectrum.npz")))

# Associate CGS units to ndarrays of reference quantities.
ndarrays.update(
Expand Down
2 changes: 1 addition & 1 deletion tardis/tests/tests_slow/test_w7.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class TestW7(object):
@classmethod
@pytest.fixture(scope="class", autouse=True)
def setup(self, request, reference, data_path, atomic_data_fname,
slow_tests_datadir, base_plot_dir):
reference_datadir, base_plot_dir):
"""
This method does initial setup of creating configuration and performing
a single run of integration test.
Expand Down

0 comments on commit 3d81297

Please sign in to comment.