X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/c3788d765ed4e7ddf00794085af757714bc102cf..3acd7df5c44345ad85aa97a92d582c60a4eba240:/test/python/tools/test_freeze.py diff --git a/test/python/tools/test_freeze.py b/test/python/tools/test_freeze.py index 30b673ff..f64850fb 100644 --- a/test/python/tools/test_freeze.py +++ b/test/python/tools/test_freeze.py @@ -1,13 +1,13 @@ -# SPDX-License-Identifier: GPL-2.0-only +# SPDX-License-Identifier: GPL-3.0-or-later # # This file is part of Nominatim. (https://nominatim.org) # -# Copyright (C) 2022 by the Nominatim developer community. +# Copyright (C) 2024 by the Nominatim developer community. # For a full list of authors see the git log. """ Tests for freeze functions (removing unused database parts). """ -from nominatim.tools import freeze +from nominatim_db.tools import freeze NOMINATIM_RUNTIME_TABLES = [ 'country_name', 'country_osm_grid', @@ -30,6 +30,8 @@ def test_drop_tables(temp_db_conn, temp_db_cursor, table_factory): for table in NOMINATIM_RUNTIME_TABLES + NOMINATIM_DROP_TABLES: table_factory(table) + assert not freeze.is_frozen(temp_db_conn) + freeze.drop_update_tables(temp_db_conn) for table in NOMINATIM_RUNTIME_TABLES: @@ -38,18 +40,20 @@ def test_drop_tables(temp_db_conn, temp_db_cursor, table_factory): for table in NOMINATIM_DROP_TABLES: assert not temp_db_cursor.table_exists(table) + assert freeze.is_frozen(temp_db_conn) + def test_drop_flatnode_file_no_file(): - freeze.drop_flatnode_file('') + freeze.drop_flatnode_file(None) def test_drop_flatnode_file_file_already_gone(tmp_path): - freeze.drop_flatnode_file(str(tmp_path / 'something.store')) + freeze.drop_flatnode_file(tmp_path / 'something.store') -def test_drop_flatnode_file_delte(tmp_path): +def test_drop_flatnode_file_delete(tmp_path): flatfile = tmp_path / 'flatnode.store' flatfile.write_text('Some content') - freeze.drop_flatnode_file(str(flatfile)) + freeze.drop_flatnode_file(flatfile) assert not flatfile.exists()