Skip to content

Commit

Permalink
Only append to existing test reports if running under CI
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Apr 26, 2023
1 parent ecab2bf commit e2ad92e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion python/testing/__init__.py
Expand Up @@ -91,7 +91,15 @@ def write_local_html_report(cls, report: str):
QDir().mkpath(report_dir.path())

report_file = report_dir.filePath('index.html')
with open(report_file, 'ta', encoding='utf-8') as f:

# only append to existing reports if running under CI
if cls.is_ci_run() or \
os.environ.get("QGIS_APPEND_TO_TEST_REPORT") == 'true':
file_mode = 'ta'
else:
file_mode = 'wt'

with open(report_file, file_mode, encoding='utf-8') as f:
f.write(f"<h1>Python {cls.__name__} Tests</h1>\n")
f.write(report)

Expand Down

0 comments on commit e2ad92e

Please sign in to comment.