]> git.openstreetmap.org Git - nominatim.git/blobdiff - test/python/test_tools_admin.py
port database setup function to python
[nominatim.git] / test / python / test_tools_admin.py
index a40a17dbb950f2f9fbf1f82d19bbaa164cfd81d8..36c7d6ff0365ecc9e43a4c0a5ecd3efe6e994276 100644 (file)
@@ -9,9 +9,8 @@ from nominatim.tools import admin
 
 @pytest.fixture
 def db(temp_db, placex_table):
-    conn = connect('dbname=' + temp_db)
-    yield conn
-    conn.close()
+    with connect('dbname=' + temp_db) as conn:
+        yield conn
 
 def test_analyse_indexing_no_objects(db):
     with pytest.raises(UsageError):