Skip to content

Commit 32e0fdf

Browse files
authored
Auto cancel Postgres checks after tests (DataDog#21500)
* Auto cancel Postgres checks after tests * Lint * Fix * Lint * Revert
1 parent 1248b84 commit 32e0fdf

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

postgres/tests/conftest.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,19 @@ def check():
8282
return c
8383

8484

85-
@pytest.fixture
85+
@pytest.fixture(scope="function")
8686
def integration_check() -> Callable[[dict, Optional[dict]], PostgreSql]:
87+
c = None
88+
8789
def _check(instance: dict, init_config: dict = None):
90+
nonlocal c
8891
c = PostgreSql('postgres', init_config or {}, [instance])
8992
return c
9093

91-
return _check
94+
yield _check
95+
96+
if c:
97+
c.cancel()
9298

9399

94100
@pytest.fixture

0 commit comments

Comments
 (0)