-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathconftest.py
More file actions
41 lines (34 loc) · 1.15 KB
/
conftest.py
File metadata and controls
41 lines (34 loc) · 1.15 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
29
30
31
32
33
34
35
36
37
38
39
40
41
"""Shared pytest configuration for unit tests."""
import unittest
import pytest
_LEGACY_TESTCASE_FILES = frozenset(
{
"test_secrets_decorator.py",
"test_s3_storage.py",
"test_system_context.py",
}
)
def pytest_collection_modifyitems(items):
for item in items:
if not isinstance(item, pytest.Function):
continue
if item.cls and issubclass(item.cls, unittest.TestCase):
filename = item.fspath.basename
if filename not in _LEGACY_TESTCASE_FILES:
item.add_marker(
pytest.mark.xfail(
reason=(
"unittest.TestCase is not allowed in new tests. "
"See CONTRIBUTING.md Test conventions."
),
strict=True,
)
)
def pytest_addoption(parser):
"""Add custom command line options shared across unit test suites."""
parser.addoption(
"--use-latest",
action="store_true",
default=False,
help="Use latest run of each flow instead of running new ones",
)