Skip to content

Commit

Permalink
Fail test run if any warnings present
Browse files Browse the repository at this point in the history
Tiny pytest plugin borrowed from ehrQL. This forces us to either deal
with or explicitly silence any warnings.
  • Loading branch information
evansd committed Jan 19, 2024
1 parent 940cfb5 commit 4857f3d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Fail the test run if we see any warnings
def pytest_terminal_summary(terminalreporter, exitstatus, config):
if terminalreporter.stats.get("warnings"): # pragma: no cover
print("\nWARNINGS DETECTED: Exiting with error")
if terminalreporter._session.exitstatus == 0:
terminalreporter._session.exitstatus = 13

0 comments on commit 4857f3d

Please sign in to comment.