-
-
Notifications
You must be signed in to change notification settings - Fork 103
Expand file tree
/
Copy pathconftest.py
More file actions
97 lines (85 loc) · 2.06 KB
/
conftest.py
File metadata and controls
97 lines (85 loc) · 2.06 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
from pathlib import Path
import pytest
CURRENT_DIR = Path(__file__).parent
TESTCASES_DIR = CURRENT_DIR
# xfail sets — all tests currently fail identically on both engines
XFAIL_BOTH = {
# mandatory — invoke-related
"test191",
"test192",
"test207",
"test215",
"test216",
"test220",
"test223",
"test224",
"test225",
"test226",
"test228",
"test229",
"test232",
"test233",
"test234",
"test235",
"test236",
"test239",
"test240",
"test241",
"test243",
"test244",
"test245",
"test247",
"test253",
"test276",
"test338",
"test347",
"test422",
"test530",
# optional
"test201",
"test446",
"test509",
"test510",
"test518",
"test519",
"test520",
"test522",
"test531",
"test532",
"test534",
"test557",
"test558",
"test561",
"test567",
"test577",
}
XFAIL_SYNC_ONLY: set[str] = set()
XFAIL_ASYNC_ONLY: set[str] = set()
XFAIL_SYNC = XFAIL_BOTH | XFAIL_SYNC_ONLY
XFAIL_ASYNC = XFAIL_BOTH | XFAIL_ASYNC_ONLY
@pytest.fixture(scope="session")
def should_generate_debug_diagram(request):
return request.config.getoption("--gen-diagram")
def compute_testcase_marks(testcase_path: Path, is_async: bool) -> list[pytest.MarkDecorator]:
marks: list[pytest.MarkDecorator] = [pytest.mark.scxml]
test_id = testcase_path.stem
xfail_set = XFAIL_ASYNC if is_async else XFAIL_SYNC
if test_id in xfail_set:
marks.append(pytest.mark.xfail)
return marks
def pytest_generate_tests(metafunc):
if "testcase_path" not in metafunc.fixturenames:
return
is_async = "async" in metafunc.function.__name__
metafunc.parametrize(
"testcase_path",
[
pytest.param(
testcase_path,
id=str(testcase_path.relative_to(TESTCASES_DIR)),
marks=compute_testcase_marks(testcase_path, is_async),
)
for testcase_path in TESTCASES_DIR.glob("**/*.scxml")
if "sub" not in testcase_path.name
],
)