pytest: Reduce the db_provider fixture scope to function

For performance reasons we were starting one for each session, which caused
the same postgres DB to be re-used for multiple tests (all test run in the
same worker process), but this could lead to interactions if there is a
timeout or a test happens to touch the `db_provider`. It turns out that we
were only saving about 15 seconds on a 1250 second run anyway, which is a
small cost for increased test isolation.
This commit is contained in:
Christian Decker 2020-09-23 16:55:04 +02:00 committed by Rusty Russell
parent 7e99a3b5fd
commit 5809cc41f4

View File

@ -316,7 +316,7 @@ providers = {
}
@pytest.fixture(scope="session")
@pytest.fixture
def db_provider(test_base_dir):
provider = providers[os.getenv('TEST_DB_PROVIDER', 'sqlite3')](test_base_dir)
provider.start()