forked from industrial-optimization-group/DESDEO
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
28 lines (21 loc) · 1.03 KB
/
Copy pathconftest.py
File metadata and controls
28 lines (21 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""Project-wide pytest configuration.
This root conftest applies to every test path declared in ``pyproject.toml``
(``testpaths = ["tests", "desdeo/api/tests"]``).
"""
import os
import pytest
def pytest_collection_modifyitems(config, items):
"""Skip ``fixme``-marked tests when ``TESTMON_SKIP_FIXME`` is set.
``just test-changes`` relies on pytest-testmon, which cannot be combined
with a ``-m`` mark expression (doing so stops testmon from saving a stable
baseline, so it silently reruns the whole suite). We therefore cannot pass
``-m "not fixme"`` there. Instead, the recipe sets ``TESTMON_SKIP_FIXME=1``
and this hook converts the would-be deselection into a skip, which testmon
tolerates. Other recipes (``just test``, ``just test-all``) are unaffected.
"""
if not os.environ.get("TESTMON_SKIP_FIXME"):
return
skip_fixme = pytest.mark.skip(reason="fixme test skipped via TESTMON_SKIP_FIXME")
for item in items:
if "fixme" in item.keywords:
item.add_marker(skip_fixme)