view test/conftest.py @ 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 3071db43bfb6
children 43dc610bbd24
line wrap: on
line source

# simple way to see if there are order dependencies in tests
# can use if pytest-random-order --random-order mode isn't
# usable (e.g. python2).

#def pytest_collection_modifyitems(items): 
#    items.reverse()

# Add a marker for pg_schema tests.
# They duplicate the postgresql tests exactly but uses a named
# schema rather than the default 'public' schema.
def pytest_configure(config):
    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/