Skip to content

Commit

Permalink
[tda] add explicit config setting for collecting mock data
Browse files Browse the repository at this point in the history
  • Loading branch information
asottile-sentry authored and realkosty committed Nov 26, 2023
1 parent 1adf397 commit ac9269b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions tda/config.local.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
collect_mock_data: true

browsers:
- remote: false
browserName: chrome
Expand Down
2 changes: 2 additions & 0 deletions tda/config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
collect_mock_data: false

browsers:
- remote: true
browserName: chrome
Expand Down
4 changes: 3 additions & 1 deletion tda/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, ...]
Expand All @@ -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']),
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit ac9269b

Please sign in to comment.