diff --git a/validphys2/src/validphys/tests/conftest.py b/validphys2/src/validphys/tests/conftest.py index 5eec1717b4..d967b44499 100644 --- a/validphys2/src/validphys/tests/conftest.py +++ b/validphys2/src/validphys/tests/conftest.py @@ -4,6 +4,7 @@ Pytest fixtures. """ import pathlib +import sys import pytest from hypothesis import settings @@ -84,3 +85,15 @@ def weighted_data_witht0_config(data_witht0_config): config_dict = dict(data_witht0_config) config_dict.update({'experiments': WEIGHTED_DATA}) return config_dict + +def pytest_runtest_setup(item): + ALL = {"darwin", "linux"} + supported_platforms = ALL.intersection(mark.name for mark in item.iter_markers()) + plat = sys.platform + if supported_platforms and plat not in supported_platforms: + pytest.skip("cannot run on platform {}".format(plat)) + +def pytest_configure(config): + config.addinivalue_line( + "markers", "linux: mark test to run only on linux" + ) \ No newline at end of file diff --git a/validphys2/src/validphys/tests/test_plots.py b/validphys2/src/validphys/tests/test_plots.py index a3cb2c0429..99c80e60e0 100644 --- a/validphys2/src/validphys/tests/test_plots.py +++ b/validphys2/src/validphys/tests/test_plots.py @@ -6,6 +6,7 @@ from validphys.api import API +@pytest.mark.linux @pytest.mark.mpl_image_compare def test_plotpdfs(): pdfs = ['NNPDF31_nnlo_as_0118'] @@ -14,6 +15,7 @@ def test_plotpdfs(): #plot_pdfs returns a generator with (figure, name_hint) return next(API.plot_pdfs(pdfs=pdfs, Q=Q, flavours=flavours))[0] +@pytest.mark.linux @pytest.mark.mpl_image_compare def test_dataspecschi2(): experiments = [ @@ -34,6 +36,7 @@ def test_dataspecschi2(): return API.plot_dataspecs_datasets_chi2( experiments=experiments, dataspecs=dataspecs, use_cuts='nocuts') +@pytest.mark.linux @pytest.mark.mpl_image_compare def test_plot_xq2(): theoryid = 53