from .config import Configuration
from .tools.exec_utils import run_legacy_script, run_api_script
-from .indexer.indexer import Indexer
-
def _num_system_cpus():
try:
cpus = len(os.sched_getaffinity(0))
@staticmethod
def run(args):
+ from .indexer.indexer import Indexer
+
indexer = Indexer(args.config.get_libpq_dsn(),
args.threads or _num_system_cpus() or 1)
import pytest
import nominatim.cli
+import nominatim.indexer.indexer
def call_nominatim(*args):
return nominatim.cli.nominatim(module_dir='build/module',
with conn.cursor() as cur:
cur.execute("CREATE TABLE import_status (indexed bool)")
bnd_mock = MockParamCapture()
- monkeypatch.setattr(nominatim.cli.Indexer, 'index_boundaries', bnd_mock)
+ monkeypatch.setattr(nominatim.indexer.indexer.Indexer, 'index_boundaries', bnd_mock)
rank_mock = MockParamCapture()
- monkeypatch.setattr(nominatim.cli.Indexer, 'index_by_rank', rank_mock)
+ monkeypatch.setattr(nominatim.indexer.indexer.Indexer, 'index_by_rank', rank_mock)
assert 0 == call_nominatim('index', *params)