]> git.openstreetmap.org Git - nominatim.git/blob - test/python/test_tools_tiger_data.py
Added test and removed runlegacyscript
[nominatim.git] / test / python / test_tools_tiger_data.py
1 """
2 Test for tiger data function
3 """
4 from pathlib import Path
5
6 import pytest
7
8 from nominatim.tools import tiger_data, database_import
9
10
11 @pytest.mark.parametrize("threads", (1, 5))
12 def test_add_tiger_data(dsn, src_dir, def_config, monkeypatch,tmp_path,
13                         temp_db_cursor, threads, temp_db):
14     monkeypatch.setenv('NOMINATIM_DATABASE_MODULE_PATH', '.')
15     temp_db_cursor.execute('CREATE EXTENSION hstore')
16     temp_db_cursor.execute('CREATE EXTENSION postgis')
17     temp_db_cursor.execute('CREATE TABLE place (id INT)')
18
19     database_import.import_base_data('dbname=' + temp_db, src_dir / 'data',
20                                      ignore_partitions=False)
21     sqlfile = tmp_path / '1010.sql'
22     sqlfile.write_text("""INSERT INTO place values (1)""")
23     tiger_data.add_tiger_data(dsn, str(tmp_path), threads, def_config, src_dir / 'lib-sql')
24
25     assert temp_db_cursor.table_rows('place') == 1