move import-data option to native python

This adds a new dependecy to the Python psutil package.
This commit is contained in:
Sarah Hoffmann
2021-02-24 17:21:45 +01:00
parent 7222235579
commit 32683f73c7
21 changed files with 205 additions and 93 deletions

View File

@@ -2,6 +2,7 @@
Tests for specialised conenction and cursor classes.
"""
import pytest
import psycopg2
from nominatim.db.connection import connect, get_pg_env
@@ -30,6 +31,22 @@ def test_connection_index_exists(db, temp_db_cursor):
assert db.index_exists('some_index', table='bar') == False
def test_drop_table_existing(db, temp_db_cursor):
temp_db_cursor.execute('CREATE TABLE dummy (id INT)')
assert db.table_exists('dummy')
db.drop_table('dummy')
assert not db.table_exists('dummy')
def test_drop_table_non_existsing(db):
db.drop_table('dfkjgjriogjigjgjrdghehtre')
def test_drop_table_non_existing_force(db):
with pytest.raises(psycopg2.ProgrammingError, match='.*does not exist.*'):
db.drop_table('dfkjgjriogjigjgjrdghehtre', if_exists=False)
def test_connection_server_version_tuple(db):
ver = db.server_version_tuple()