Skip to content

Commit 5fabf97

Browse files
committed
execute slow tests last
1 parent aa0b48f commit 5fabf97

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

pytest.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[pytest]
2+
addopts = --strict-markers
3+
markers =
4+
slow: mark tests as slow.

test/conftest.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from _pytest.mark import Mark
2+
3+
4+
empty_mark = Mark('', [], {})
5+
6+
7+
def by_slow_marker(item):
8+
return item.get_closest_marker('slow', default=empty_mark)
9+
10+
11+
def pytest_collection_modifyitems(items):
12+
items.sort(key=by_slow_marker, reverse=False)

test/test_bakta.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import pytest
2+
13
from pathlib import Path
24
from subprocess import run
35

@@ -14,6 +16,7 @@
1416
]
1517

1618

19+
@pytest.mark.slow
1720
def test_bakta_mock_skipped_features(tmpdir):
1821
# fast test skipping all feature detections
1922
proc = run(["bin/bakta", '--db', 'test/db', '--output', tmpdir, '--prefix', 'test', '--skip-tmrna', '--skip-trna', '--skip-rrna', '--skip-ncrna', '--skip-ncrna-region', '--skip-crispr', '--skip-cds', '--skip-sorf', '--skip-ori', '--skip-gap', 'test/data/NC_002127.1.fna'])
@@ -24,6 +27,7 @@ def test_bakta_mock_skipped_features(tmpdir):
2427
assert Path.exists(tmpdir_path.joinpath(file))
2528

2629

30+
@pytest.mark.slow
2731
def test_bakta_plasmid(tmpdir):
2832
# full test on plasmid
2933
proc = run(["bin/bakta", '--db', 'test/db', '--output', tmpdir, '--prefix', 'test', 'test/data/NC_002127.1.fna'])
@@ -34,6 +38,7 @@ def test_bakta_plasmid(tmpdir):
3438
assert Path.exists(tmpdir_path.joinpath(file))
3539

3640

41+
@pytest.mark.slow
3742
def test_bakta_genome(tmpdir):
3843
# full test on plasmid
3944
proc = run(["bin/bakta", '--db', 'test/db', '--output', tmpdir, '--prefix', 'test', 'test/data/GCF_000008865.2.fna.gz'])

0 commit comments

Comments
 (0)