Skip to content

Commit f2d88c4

Browse files
authored
Update database.py
1 parent a5c7ffc commit f2d88c4

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

cubedash/testutils/database.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ def odc_test_db(odc_db: str, cfg_env: ODCEnvironment) -> Generator[Datacube]:
282282

283283
yield dc
284284

285-
dc.close()
285+
286286

287287
# Drops the AGDC schema - badly named function
288288
pgres_core.drop_db(conn)
@@ -291,6 +291,8 @@ def odc_test_db(odc_db: str, cfg_env: ODCEnvironment) -> Generator[Datacube]:
291291
# and attempts to recreate them.
292292
_remove_postgres_dynamic_indexes()
293293

294+
dc.close()
295+
294296
else:
295297
with index._db._engine.begin() as conn: # type: ignore[attr-defined]
296298
for table in [
@@ -308,12 +310,11 @@ def odc_test_db(odc_db: str, cfg_env: ODCEnvironment) -> Generator[Datacube]:
308310

309311
yield dc
310312

311-
dc.close()
312-
313313
# Drop the ODC Schema - Badly named function
314314
pgis_core.drop_db(conn)
315315

316316
_remove_postgis_dynamic_indexes()
317+
dc.close()
317318

318319

319320
def _remove_postgres_dynamic_indexes() -> None:

0 commit comments

Comments
 (0)