diff --git a/docs/integration.yml b/docs/integration.yml index a3b99f6bb3e..3d3ab2cef9b 100644 --- a/docs/integration.yml +++ b/docs/integration.yml @@ -19,13 +19,11 @@ report: reportpath: "~/projects/tardis/integration" -# Path to directory containing reference HDF files. -reference: "~/projects/tardis/integration/" - # Path to directory where reference HDF files will be generated and # saved during the test run. Use "--generate-reference" flag in command -# line args for the purpose, for other cases this will be simply ignored. -generate_reference: "~/projects/tardis/integration/" +# line args for the purpose, for other cases this will denote path +# to the directory containing reference HDF files. +reference: "~/projects/tardis/integration/" # Speeds up test execution by reducing amount of packets per iteration, diff --git a/tardis/tests/integration_tests/conftest.py b/tardis/tests/integration_tests/conftest.py index 980a35fa634..f087bcce884 100644 --- a/tardis/tests/integration_tests/conftest.py +++ b/tardis/tests/integration_tests/conftest.py @@ -40,7 +40,7 @@ def pytest_terminal_summary(terminalreporter): terminalreporter.config.getvalue("integration-tests")): # TODO: Add a check whether generation was successful or not. terminalreporter.write_sep("-", "Generated reference data: {0}".format(os.path.join( - terminalreporter.config.integration_tests_config['generate_reference'], + terminalreporter.config.integration_tests_config['reference'], tardis_githash[:7] ))) @@ -77,15 +77,18 @@ def plot_object(request): def data_path(request): integration_tests_config = request.config.integration_tests_config hdf_filename = "{0}.h5".format(os.path.basename(request.param)) + if (request.config.getoption("--generate-reference") ): + ref_path = os.path.join(os.path.expandvars(os.path.expanduser( + integration_tests_config['reference'])), tardis_githash[:7] + ) + else: + ref_path = os.path.join(os.path.expandvars( + os.path.expanduser(integration_tests_config['reference'])), hdf_filename + ) path = { 'config_dirpath': request.param, - 'reference_filepath': os.path.join(os.path.expandvars( - os.path.expanduser(integration_tests_config['reference'])), hdf_filename - ), - 'gen_ref_path': os.path.join(os.path.expandvars(os.path.expanduser( - integration_tests_config['generate_reference'])), tardis_githash[:7] - ), + 'reference_path': ref_path, 'setup_name': hdf_filename[:-3], # Temporary hack for providing atom data per individual setup. # This url has all the atom data files hosted, for downloading. @@ -99,8 +102,8 @@ def data_path(request): )) if (request.config.getoption("--generate-reference") and not - os.path.exists(path['gen_ref_path'])): - os.makedirs(path['gen_ref_path']) + os.path.exists(path['reference_path'])): + os.makedirs(path['reference_path']) return path @@ -110,7 +113,7 @@ def reference(request, data_path): HDF file. All data is unpacked as a collection of ``pd.Series`` and ``pd.DataFrames`` in a ``pd.HDFStore`` object and returned away. - Assumed that ``data_path['reference_filepath']`` is a valid HDF file + Assumed that ``data_path['reference_path']`` is a valid HDF file containing the reference dath for a particular setup. """ # Reference data need not be loaded and provided if current test run itself @@ -119,10 +122,10 @@ def reference(request, data_path): return else: try: - reference = pd.HDFStore(data_path['reference_filepath'], 'r') + reference = pd.HDFStore(data_path['reference_path'], 'r') except IOError: raise IOError('Reference file {0} does not exist and is needed' - ' for the tests'.format(data_path['reference_filepath'])) + ' for the tests'.format(data_path['reference_path'])) else: return reference diff --git a/tardis/tests/integration_tests/test_integration.py b/tardis/tests/integration_tests/test_integration.py index 43895aa409c..3939d208517 100644 --- a/tardis/tests/integration_tests/test_integration.py +++ b/tardis/tests/integration_tests/test_integration.py @@ -129,7 +129,7 @@ def setup(self, request, reference, data_path, pytestconfig): self.result.run() if request.config.getoption("--generate-reference"): ref_data_path = os.path.join( - data_path['gen_ref_path'], "{0}.h5".format(self.name) + data_path['reference_path'], "{0}.h5".format(self.name) ) if os.path.exists(ref_data_path): pytest.skip( @@ -137,7 +137,7 @@ def setup(self, request, reference, data_path, pytestconfig): 'proceed generating new data'.format(ref_data_path)) self.result.to_hdf(file_path=ref_data_path) pytest.skip("Reference data saved at {0}".format( - data_path['gen_ref_path'] + data_path['reference_path'] )) capmanager.resumecapture()