changeset 8251:619b723dd2bb

test: try to handle loss of testmon data when cancelling test. Not sure if this works, but I was having an issue where the testmon database was not being saved properly. When I used ^C to cancel a run, the next run with --testmon would select no tests even when I changed files. The only was to get working again was to delete the .testmon, .testmon-wal and .testmon-shm files and rerun the whole test suite. Once the full test suite was run, changing the file would select tests again.
author John Rouillard <rouilj@ieee.org>
date Wed, 01 Jan 2025 00:54:58 -0500
parents c7f63e9cd131
children 8a875e0bf749
files test/conftest.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/test/conftest.py	Wed Jan 01 00:47:14 2025 -0500
+++ b/test/conftest.py	Wed Jan 01 00:54:58 2025 -0500
@@ -12,3 +12,9 @@
     config.addinivalue_line(
         "markers", "pg_schema: tests using schema for postgres"
     )
+
+# try to work around loss of testmon data when ^Cing out of tests.
+def pytest_unconfigure(config):
+    if hasattr(config, "testmon_data"):
+        config.testmon_data.db.con.close()
+

Roundup Issue Tracker: http://roundup-tracker.org/