From 7620142d0d9b7550a08f386a07baddf10e75f11c Mon Sep 17 00:00:00 2001 From: anthony sottile Date: Fri, 17 Nov 2023 16:13:45 -0500 Subject: [PATCH] [tda] add explicit config setting for collecting mock data --- tda/config.local.yaml | 2 ++ tda/config.yaml | 2 ++ tda/conftest.py | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tda/config.local.yaml b/tda/config.local.yaml index 1bcac640..0fac74ad 100644 --- a/tda/config.local.yaml +++ b/tda/config.local.yaml @@ -1,3 +1,5 @@ +collect_mock_data: true + browsers: - remote: false browserName: chrome diff --git a/tda/config.yaml b/tda/config.yaml index a5890b00..cd9a5330 100644 --- a/tda/config.yaml +++ b/tda/config.yaml @@ -1,3 +1,5 @@ +collect_mock_data: false + browsers: - remote: true browserName: chrome diff --git a/tda/conftest.py b/tda/conftest.py index b1c517cf..0cd79230 100644 --- a/tda/conftest.py +++ b/tda/conftest.py @@ -57,6 +57,7 @@ def param_display(self) -> str: class Config(NamedTuple): + collect_mock_data: bool browsers: tuple[Browser, ...] dsn: str react_endpoints: tuple[str, ...] @@ -68,6 +69,7 @@ def _config() -> Config: with open(cfg_filename) as f: contents = yaml.safe_load(f) return Config( + collect_mock_data=contents['collect_mock_data'], browsers=tuple(Browser(**d) for d in contents['browsers']), dsn=contents['dsn'], react_endpoints=tuple(contents['react_endpoints']), @@ -499,7 +501,7 @@ def pytest_runtest_makereport(item, call): # be "setup", "call", "teardown" setattr(item, "rep_" + rep.when, rep) -if 'localhost' not in CONFIG.dsn: +if not CONFIG.collect_mock_data: def final_report(): end_time = get_current_time_iso_utc(adjust_seconds=1) start = urllib.parse.quote(start_time)