Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade pytest version #1185

Merged
merged 7 commits into from
Jun 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion azure-pipelines/simple_test_framework.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
- bash: |
source activate tardis
conda install -y pytest-cov
pip install git+https://github.com/tonybaloney/pytest-azurepipelines.git
pip install pytest-azurepipelines
pytest tardis --tardis-refdata=$(ref.data.home) --cov=tardis --cov-report=xml --cov-report=html

displayName: "TARDIS test"
Expand Down
8 changes: 4 additions & 4 deletions tardis/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,17 +139,17 @@ def pytest_addoption(parser):


@pytest.fixture(scope='session')
def generate_reference():
option = pytest.config.getvalue("generate_reference")
def generate_reference(pytestconfig):
option = pytestconfig.getvalue("generate_reference")
if option is None:
return False
else:
return option


@pytest.fixture(scope="session")
def tardis_ref_path():
tardis_ref_path = pytest.config.getvalue("tardis_refdata")
def tardis_ref_path(pytestconfig):
tardis_ref_path = pytestconfig.getvalue("tardis_refdata")
if tardis_ref_path is None:
pytest.skip('--tardis-refdata was not specified')
else:
Expand Down
4 changes: 2 additions & 2 deletions tardis/montecarlo/tests/test_packet_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ def packet_unit_test_fpath(tardis_ref_path):
return os.path.abspath(os.path.join(
tardis_ref_path, 'packet_unittest.h5'))

def test_bb_packet_sampling(tardis_ref_data, packet_unit_test_fpath):
def test_bb_packet_sampling(pytestconfig, tardis_ref_data, packet_unit_test_fpath):
bb = BlackBodySimpleSource(2508)
#ref_df = pd.read_hdf('test_bb_sampling.h5')
if pytest.config.getvalue("--generate-reference"):
if pytestconfig.getvalue("--generate-reference"):
ref_bb = pd.read_hdf(packet_unit_test_fpath, key='/blackbody')
ref_bb.to_hdf(tardis_ref_data, key='/packet_unittest/blackbody',
mode='a')
Expand Down
4 changes: 2 additions & 2 deletions tardis/plasma/tests/test_complete_plasmas.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ def config(self, request):
return config

@pytest.fixture(scope="class")
def plasma(self, chianti_he_db_fpath, config, tardis_ref_data):
def plasma(self, pytestconfig, chianti_he_db_fpath, config, tardis_ref_data):
config['atom_data'] = chianti_he_db_fpath
sim = Simulation.from_config(config)
if pytest.config.getvalue("--generate-reference"):
if pytestconfig.getvalue("--generate-reference"):
sim.plasma.to_hdf(tardis_ref_data, path=config.plasma.save_path)
pytest.skip("Reference data saved at {0}".format(tardis_ref_data))
return sim.plasma
Expand Down
2 changes: 1 addition & 1 deletion tardis/tests/integration_tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def model_quantities(request):
return request.param


@pytest.mark.skipif(not pytest.config.getvalue("integration-tests"),
@pytest.mark.skipif('not config.getvalue("integration-tests")',
reason="integration tests are not included in this run")
@pytest.mark.integration
class TestIntegration(object):
Expand Down
2 changes: 1 addition & 1 deletion tardis_env3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ dependencies:

#Test/Coverage requirements
- git-lfs
- pytest=4
- pytest=5
- pytest-html
- requests
- coverage
Expand Down