Skip to content

Commit 258271b

Browse files
committed
Remove QAS marker rewriting from conftest
qas-cli 0.4.6 now matches test case markers directly from pytest function names like test_bd023_foo without rewriting.
1 parent 26915d5 commit 258271b

File tree

1 file changed

+0
-28
lines changed

1 file changed

+0
-28
lines changed

tests/conftest.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,10 @@
11
import os
2-
import re
32

43
import pytest
54
from dotenv import load_dotenv
65

76
load_dotenv()
87

9-
# QA Sphere project code. Used to detect test case markers in function names.
10-
# e.g. test_bd023_cart_operations -> BD-023:test_bd023_cart_operations
11-
QAS_PROJECT_CODE = "BD"
12-
13-
_QAS_MARKER_RE = re.compile(rf"test_({QAS_PROJECT_CODE})(\d+)_", re.IGNORECASE)
14-
15-
16-
def _rewrite_qas_name(name: str) -> str:
17-
"""Rewrite test name to include QA Sphere marker prefix.
18-
19-
test_bd023_cart_operations[chromium] -> BD-023:test_bd023_cart_operations[chromium]
20-
"""
21-
m = _QAS_MARKER_RE.match(name)
22-
if not m:
23-
return name
24-
code = m.group(1).upper()
25-
seq = m.group(2)
26-
return f"{code}-{seq}:{name}"
27-
28-
29-
def pytest_itemcollected(item: pytest.Item) -> None:
30-
"""Rewrite test node IDs so JUnit XML contains QA Sphere markers."""
31-
new_name = _rewrite_qas_name(item.name)
32-
if new_name != item.name:
33-
item._nodeid = item._nodeid.replace(item.name, new_name)
34-
item.name = new_name
35-
368

379
@pytest.fixture(scope="session")
3810
def demo_base_url() -> str:

0 commit comments

Comments
 (0)