Skip to content

Commit ea995f6

Browse files
authored
Merge pull request #423 from EIT-ALIVE/fix/decrease_num_ratedetection_tests
Decrease the number of tests for RateDetection
2 parents 1637bc5 + 917de4a commit ea995f6

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

.github/workflows/release_github.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ jobs:
9393
data-directory: ${{ env.EIT_PROCESSING_TEST_DATA }}
9494

9595
- name: Run pytest
96-
run: pytest -v
96+
run: pytest -v --runslow
9797

9898
- name: Install additional dependencies for building
9999
run: python3 -m pip install --upgrade ".[publishing]"

tests/conftest.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,23 @@
2222
dummy_file = data_directory / "not_a_file.dummy"
2323

2424

25+
def pytest_addoption(parser: pytest.Parser):
26+
parser.addoption("--runslow", action="store_true", default=False, help="run tests marked as slow")
27+
28+
29+
def pytest_configure(config: pytest.Config):
30+
config.addinivalue_line("markers", "slow: mark test as slow to run")
31+
32+
33+
def pytest_collection_modifyitems(config: pytest.Config, items: list[pytest.Item]):
34+
if config.getoption("--runslow"):
35+
return
36+
skip_slow = pytest.mark.skip(reason="need --runslow option to run")
37+
for item in items:
38+
if "slow" in item.keywords:
39+
item.add_marker(skip_slow)
40+
41+
2542
@pytest.fixture(scope="session")
2643
def draeger1() -> Sequence:
2744
return load_eit_data(draeger_file1, vendor="draeger", sample_frequency=20, label="draeger1")

tests/test_rate_detection.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ def test_short_signal(signal_factory: Callable[..., EITData]):
179179
duration = np.linspace(10, 60, 5)
180180

181181

182+
@pytest.mark.slow
182183
@pytest.mark.parametrize(
183184
("high_power_frequency", "low_power_frequency", "duration"),
184185
list(itertools.product(high_power_frequencies, low_power_frequencies, duration)),
@@ -212,6 +213,7 @@ def test_frequencies(
212213
assert np.isclose(non_refined_hr, low_power_frequency, rtol=0.2, atol=1 / MINUTE)
213214

214215

216+
@pytest.mark.slow
215217
@pytest.mark.parametrize(
216218
("high_power_frequency", "harmonic_multiplier", "duration"),
217219
list(itertools.product(high_power_frequencies, range(2, 5), duration)),
@@ -247,6 +249,7 @@ def test_harmonic_heart_rate(
247249
assert np.isclose(hr, low_power_frequency, rtol=0.05, atol=0.5 / MINUTE)
248250

249251

252+
@pytest.mark.slow
250253
@pytest.mark.parametrize(
251254
("high_power_frequency", "low_power_frequency", "frequency_multipliers"),
252255
list(itertools.product(high_power_frequencies, low_power_frequencies, [(1, 1.3), (1, 1.4)])),
@@ -291,6 +294,7 @@ def test_multiple_frequencies(
291294
scale_factors = (0.8, 0.9, 1.0, 1.1, 1.2)
292295

293296

297+
@pytest.mark.slow
294298
@pytest.mark.parametrize(
295299
("high_power_frequency", "low_power_frequency", "high_frequency_scale_factor", "low_frequency_scale_factor"),
296300
list(itertools.product(high_power_frequencies, low_power_frequencies, scale_factors, scale_factors)),

0 commit comments

Comments
 (0)