mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2025-07-11 19:31:50 +02:00

- No changes or evaluation of existing tests - Tags for including tests that require data is changed to **[.with-data]** and **--with-data** for C++ and python respectively - Minor update to docs - Added missing files to the test data repo
35 lines
842 B
Python
35 lines
842 B
Python
import os
|
|
from pathlib import Path
|
|
import pytest
|
|
|
|
|
|
|
|
def pytest_addoption(parser):
|
|
parser.addoption(
|
|
"--with-data", action="store_true", default=False, help="Run tests that require additional data"
|
|
)
|
|
|
|
|
|
def pytest_configure(config):
|
|
config.addinivalue_line("markers", "withdata: mark test as needing image files to run")
|
|
|
|
|
|
def pytest_collection_modifyitems(config, items):
|
|
if config.getoption("--with-data"):
|
|
return
|
|
skip = pytest.mark.skip(reason="need --with-data option to run")
|
|
for item in items:
|
|
if "withdata" in item.keywords:
|
|
item.add_marker(skip)
|
|
|
|
|
|
@pytest.fixture
|
|
def test_data_path():
|
|
env_value = os.environ.get("AARE_TEST_DATA")
|
|
if not env_value:
|
|
raise RuntimeError("Environment variable AARE_TEST_DATA is not set or is empty")
|
|
|
|
return Path(env_value)
|
|
|
|
|