Skip to content

Commit 0df0958

Browse files
committed
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.
1 parent ee9ab48 commit 0df0958

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/conftest.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,9 @@ def pytest_configure(config):
1212
config.addinivalue_line(
1313
"markers", "pg_schema: tests using schema for postgres"
1414
)
15+
16+
# try to work around loss of testmon data when ^Cing out of tests.
17+
def pytest_unconfigure(config):
18+
if hasattr(config, "testmon_data"):
19+
config.testmon_data.db.con.close()
20+

0 commit comments

Comments
 (0)