]> git.openstreetmap.org Git - nominatim.git/blobdiff - test/python/conftest.py
add function to set up libpq environment
[nominatim.git] / test / python / conftest.py
index 72a56dcff581bb123ee29855589352cf3eeee47b..0e0e808cb51f953e871e199b83e7732fb1caba92 100644 (file)
@@ -85,9 +85,8 @@ def temp_db_with_extensions(temp_db):
 def temp_db_conn(temp_db):
     """ Connection to the test database.
     """
-    conn = connection.connect('dbname=' + temp_db)
-    yield conn
-    conn.close()
+    with connection.connect('dbname=' + temp_db) as conn:
+        yield conn
 
 
 @pytest.fixture