X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/0add25e33500110a36458a0bb3fa292d408d2b85..c70dfccacac90a90bfc193f49262abe7505d7d75:/test/python/db/test_utils.py?ds=sidebyside diff --git a/test/python/db/test_utils.py b/test/python/db/test_utils.py index 7c46846d..2bc7d959 100644 --- a/test/python/db/test_utils.py +++ b/test/python/db/test_utils.py @@ -2,18 +2,17 @@ # # This file is part of Nominatim. (https://nominatim.org) # -# Copyright (C) 2024 by the Nominatim developer community. +# Copyright (C) 2025 by the Nominatim developer community. # For a full list of authors see the git log. """ Tests for DB utility functions in db.utils """ -import json - import pytest import nominatim_db.db.utils as db_utils from nominatim_db.errors import UsageError + def test_execute_file_success(dsn, temp_db_cursor, tmp_path): tmpfile = tmp_path / 'test.sql' tmpfile.write_text('CREATE TABLE test (id INT);\nINSERT INTO test VALUES(56);') @@ -22,6 +21,7 @@ def test_execute_file_success(dsn, temp_db_cursor, tmp_path): assert temp_db_cursor.row_set('SELECT * FROM test') == {(56, )} + def test_execute_file_bad_file(dsn, tmp_path): with pytest.raises(FileNotFoundError): db_utils.execute_file(dsn, tmp_path / 'test2.sql')