From 5809cc41f41519c0e78ec711784ca7515aedbdac Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Wed, 23 Sep 2020 16:55:04 +0200 Subject: [PATCH] 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. --- contrib/pyln-testing/pyln/testing/fixtures.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/pyln-testing/pyln/testing/fixtures.py b/contrib/pyln-testing/pyln/testing/fixtures.py index 659ed310f..7db332840 100644 --- a/contrib/pyln-testing/pyln/testing/fixtures.py +++ b/contrib/pyln-testing/pyln/testing/fixtures.py @@ -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()