Fix setup report folders to use product and flow

This commit is contained in:
2026-09-23 12:41:29 +05:30
parent 394d2749bf
commit 97158d2006
3 changed files with 69 additions and 9 deletions
+33
View File
@@ -0,0 +1,33 @@
from types import SimpleNamespace
import pytest
from tests.conftest import _get_run_prefix, _setup_item_prefix, get_run_id
@pytest.mark.parametrize("path,product,expected", [
("tests/setup/test_combined_setup.py", "IDAS", "IDAS_SESSION_TOKEN"),
("tests/setup/test_combined_setup.py", "RTM", "RTM_SESSION_TOKEN"),
("tests/setup/tokens/test_trading_token.py", "RTM", "RTM_TOKEN"),
("tests/setup/sessions/test_session.py", "RTM", "RTM_SESSION"),
])
def test_setup_artifacts_use_collected_product_and_flow(path, product, expected):
item = SimpleNamespace(nodeid=f"{path}::test[{product}]", callspec=SimpleNamespace(
params={"config": {"product_name": product}},
))
assert _setup_item_prefix(item) == expected
@pytest.mark.parametrize("path", ["tests/setup", "tests\\setup", "tests/setup/test_combined_setup.py"])
def test_setup_report_does_not_use_regression_config(path):
config = SimpleNamespace(invocation_params=SimpleNamespace(args=(path, "-k", "RTM")))
assert _get_run_prefix(config) == "PXIL_SETUP"
def test_mixed_run_ids_are_cached_separately(tmp_path, monkeypatch):
monkeypatch.chdir(tmp_path)
(tmp_path / "reports/screenshots/RTM_TOKEN_004").mkdir(parents=True)
config = SimpleNamespace()
assert get_run_id(config, "RTM_TOKEN") == "RTM_TOKEN_005"
assert get_run_id(config, "IDAS_SESSION_TOKEN") == "IDAS_SESSION_TOKEN_001"
assert get_run_id(config, "RTM_TOKEN") == "RTM_TOKEN_005"