]> git.openstreetmap.org Git - nominatim.git/blobdiff - test/python/conftest.py
port freeze function to python
[nominatim.git] / test / python / conftest.py
index ecd40d7cf8b616c0af126d5c411c030527d30c77..72a56dcff581bb123ee29855589352cf3eeee47b 100644 (file)
@@ -36,6 +36,14 @@ class _TestingCursor(psycopg2.extras.DictCursor):
 
         return set((tuple(row) for row in self))
 
+    def table_exists(self, table):
+        """ Check that a table with the given name exists in the database.
+        """
+        num = self.scalar("""SELECT count(*) FROM pg_tables
+                             WHERE tablename = %s""", (table, ))
+        return num == 1
+
+
 @pytest.fixture
 def temp_db(monkeypatch):
     """ Create an empty database for the test. The database name is also