mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-21 16:14:23 +01:00
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:
committed by
Rusty Russell
parent
7e99a3b5fd
commit
5809cc41f4
@@ -316,7 +316,7 @@ providers = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="session")
|
@pytest.fixture
|
||||||
def db_provider(test_base_dir):
|
def db_provider(test_base_dir):
|
||||||
provider = providers[os.getenv('TEST_DB_PROVIDER', 'sqlite3')](test_base_dir)
|
provider = providers[os.getenv('TEST_DB_PROVIDER', 'sqlite3')](test_base_dir)
|
||||||
provider.start()
|
provider.start()
|
||||||
|
|||||||
Reference in New Issue
Block a user