Do not save device stats in InfluxDB if database not provided
This commit is contained in:
parent
602a33fdaa
commit
5b95872a28
|
@ -190,6 +190,12 @@ def pytest_unconfigure(config):
|
|||
pull.create_issue_comment(github_report.build_html_report(testrail_report.run_id))
|
||||
|
||||
|
||||
def should_save_device_stats(config):
|
||||
db_args = [config.getoption(option) for option in
|
||||
('stats_db_host', 'stats_db_port', 'stats_db_username', 'stats_db_password', 'stats_db_database')]
|
||||
return all(db_args)
|
||||
|
||||
|
||||
@pytest.mark.hookwrapper
|
||||
def pytest_runtest_makereport(item, call):
|
||||
outcome = yield
|
||||
|
@ -217,6 +223,7 @@ def pytest_runtest_makereport(item, call):
|
|||
else:
|
||||
test_group = None
|
||||
|
||||
if should_save_device_stats(item.config):
|
||||
device_stats_db = DeviceStatsDB(
|
||||
item.config.getoption('stats_db_host'),
|
||||
item.config.getoption('stats_db_port'),
|
||||
|
|
Loading…
Reference in New Issue