@echo Nominatim needs to be executed directly from this directory. No install necessary.
test:
- cd tests; NOMINATIM_SERVER=${NOMINATIM_SERVER} NOMINATIM_DIR=.. lettuce -t -Fail -t -poldi-only
+ cd tests; NOMINATIM_SERVER=${NOMINATIM_SERVER} lettuce -t -Fail -t -poldi-only
test-fast:
- cd tests; NOMINATIM_SERVER=${NOMINATIM_SERVER} NOMINATIM_REUSE_TEMPLATE=1 NOMINATIM_DIR=.. lettuce -t -Fail -t -poldi-only
+ cd tests; NOMINATIM_SERVER=${NOMINATIM_SERVER} NOMINATIM_REUSE_TEMPLATE=1 lettuce -t -Fail -t -poldi-only
test-db:
- cd tests; NOMINATIM_SERVER=${NOMINATIM_SERVER} NOMINATIM_DIR=.. lettuce -t -Fail -t -poldi-only -t DB
+ cd tests; NOMINATIM_SERVER=${NOMINATIM_SERVER} lettuce -t -Fail -t -poldi-only features/db
test-db-fast:
- cd tests; NOMINATIM_SERVER=${NOMINATIM_SERVER} NOMINATIM_REUSE_TEMPLATE=1 NOMINATIM_DIR=.. lettuce -t -Fail -t -poldi-only -t DB
+ cd tests; NOMINATIM_SERVER=${NOMINATIM_SERVER} NOMINATIM_REUSE_TEMPLATE=1 lettuce -t -Fail -t -poldi-only features/db
test-api:
- cd tests; NOMINATIM_SERVER=${NOMINATIM_SERVER} NOMINATIM_DIR=.. lettuce -t -Fail -t -poldi-only features/api
+ cd tests; NOMINATIM_SERVER=${NOMINATIM_SERVER} lettuce -t -Fail -t -poldi-only features/api
.PHONY: test test-fast test-db test-db-fast test-api
-Subproject commit 13c11f8842146a79cb0629b603e5acdfbb0bfd58
+Subproject commit 8fc89648fa877674e889cd26014815a3f029e039
-- Handle a place changing type by removing the old data
-- My generated 'place' types are causing havok because they overlap with real keys
-- TODO: move them to their own special purpose key/class to avoid collisions
- IF existing.osm_type IS NULL AND (NEW.type not in ('postcode','house','houses')) THEN
- DELETE FROM place where osm_type = NEW.osm_type and osm_id = NEW.osm_id and class = NEW.class and type not in ('postcode','house','houses');
+ IF existing.osm_type IS NULL THEN
+ DELETE FROM place where osm_type = NEW.osm_type and osm_id = NEW.osm_id and class = NEW.class;
END IF;
--DEBUG: RAISE WARNING 'Existing: %',existing.osm_id;
the next run. This speeds up tests considerably
but might lead to outdated errors for some
changes in the database layout.
+ * `NOMINATIM_KEEP_SCENARIO_DB` - if defined, the test database will not be
+ dropped after a test is finished. Should
+ only be used if one single scenario is run,
+ otherwise the result is undefined.
* `LOGLEVEL` - set to 'debug' to get more verbose output (only works properly
when output to a logfile is configured)
* `LOGFILE` - sends debug output to the given file
When marking for delete R1,W1
Then table placex has no entry for W1
Then table placex has no entry for R1
+
+
+ Scenario: type mutation
+ Given the place nodes
+ | osm_id | class | type | geometry
+ | 3 | shop | toys | 1 -1
+ When importing
+ Then table placex contains
+ | object | class | type
+ | N3 | shop | toys
+ When updating place nodes
+ | osm_id | class | type | geometry
+ | 3 | shop | grocery | 1 -1
+ Then table placex contains
+ | object | class | type
+ | N3 | shop | grocery
+
+
+ Scenario: remove postcode place when house number is added
+ Given the place nodes
+ | osm_id | class | type | postcode | geometry
+ | 3 | place | postcode | 12345 | 1 -1
+ When importing
+ Then table placex contains
+ | object | class | type
+ | N3 | place | postcode
+ When updating place nodes
+ | osm_id | class | type | postcode | housenumber | geometry
+ | 3 | place | house | 12345 | 13 | 1 -1
+ Then table placex contains
+ | object | class | type
+ | N3 | place | house
@DB
Feature: Import of simple objects by osm2pgsql
- Testing basic functions of osm2pgsql.
+ Testing basic tagging in osm2pgsql imports.
Scenario: Import simple objects
Given the osm nodes:
| 201 | 0 1
| 202 | 1 1
| 203 | 1 0
- Given the osm ways:
+ And the osm ways:
| id | tags | nodes
| 1 | 'shop' : 'toys', 'name' : 'tata' | 100 101 102
| 2 | 'ref' : '45' | 200 201 202 203 200
- Given the osm relations:
+ And the osm relations:
| id | tags | members
| 1 | 'type' : 'multipolygon', 'tourism' : 'hotel', 'name' : 'XZ' | N1,W2
When loading osm data
Then table place contains
| object | class | type
| N1 | place | house
+
+ Scenario: Landuses are only imported when named
+ Given the osm nodes:
+ | id | geometry
+ | 100 | 0 0
+ | 101 | 0 0.1
+ | 102 | 0.1 0.1
+ | 200 | 0 0
+ | 202 | 1 1
+ | 203 | 1 0
+ And the osm ways:
+ | id | tags | nodes
+ | 1 | 'landuse' : 'residential', 'name' : 'rainbow' | 100 101 102 100
+ | 2 | 'landuse' : 'residential' | 200 202 203 200
+ When loading osm data
+ Then table place contains
+ | object | class | type
+ | W1 | landuse | residential
+ And table place has no entry for W2
logging.basicConfig(level=loglevel)
# Nominatim test setup
self.base_url = os.environ.get('NOMINATIM_SERVER', 'http://localhost/nominatim')
- self.source_dir = os.path.abspath(os.environ.get('NOMINATIM_DIR', '../Nominatim'))
+ self.source_dir = os.path.abspath(os.environ.get('NOMINATIM_DIR', '..'))
self.template_db = os.environ.get('TEMPLATE_DB', 'test_template_nominatim')
self.test_db = os.environ.get('TEST_DB', 'test_nominatim')
self.local_settings_file = os.environ.get('NOMINATIM_SETTINGS', '/tmp/nominatim_settings.php')