@@ -143,48 +143,48 @@ BDD tests you need to have behave and psycopg installed. On Ubuntu run:
143143sudo apt-get install python3-psycopg python3-behave
144144```
145145
146+ The BDD tests are run through the osm2pgsql-test-style tester. See the
147+ [ section on testing] ( https://osm2pgsql.org/doc/manual.html#style-testing )
148+ in the manual for details.
149+
146150There are ctest directives to run the tests. If you want to run the tests
147151manually, for example to run single tests during development, you can
148- switch to the bdd test directory and run behave directly from there:
152+ use the ` run-bdd-tests ` script in the build directory. It is a thin
153+ wrapper around osm2pgsql-test-style which properly sets up the paths
154+ for the osm2pgsql binary and test data paths:
149155
150156``` sh
151- cd osm2pgsql/tests/bdd
152- behave -DBINARY= < your build directory > /osm2pgsql
157+ cd build
158+ ./run-bdd-tests ../tests/bdd/regression/
153159```
154160
155- Per default, behave assumes that the build directory is under ` osm2pgsql/build ` .
156- If your setup works like that, you can leave out the ` -D ` parameter.
157-
158- To make this a bit easier a shell script ` run-behave ` is provided in your
159- build directory which sets those correct paths and calls ` behave ` . If run
160- with ` -p ` as first option it will wrap the call to ` behave ` in a call to
161- ` pg_virtualenv ` for your convenience. All other command line parameters of
162- ` run-behave ` will be passed through to behave.
163-
164161To run a single test, simply add the name of the test file, followed by a
165162column and the line number of the test:
166163
167164``` sh
168- behave flex/area.feature:71
165+ ./run-bdd-tests ../tests/bdd/ flex/area.feature:71
169166```
170167
171- If you need to inspect the database that a test produces, you can add
172- ` -DKEEP_TEST_DB ` and behave won't remove the database after the test is
173- finished. This makes of course only sense, when running a single test.
168+ You can pass any additional parameters to the script that osm2pgsql-test-style
169+ would take. If you need to inspect the database that a test produces, you add
170+ ` --keep-test-db ` and behave won't remove the database after the test is
171+ finished. This makes only sense, when running a single test.
174172When running under pg_virtualenv, don't forget to keep the virtual environment
175173as well. You can use the handy ` -s ` switch:
176174
177175``` sh
178- pg_virtualenv -s behave -DKEEP_TEST_DB flex/area.feature:71
176+ pg_virtualenv -s ./run-bdd-tests ../tests/bdd/ flex/area.feature:71
179177```
180178
181179It drops you into a shell when the behave test fails, where you can use
182180psql to look at the database. Or start a shell in the virtual environment
183181with ` pg_virtualenv bash ` and run behave from there.
184182
185- The BDDs automatically detect if osm2pgsql was compiled with Lua and
183+ The BDDs automatically detect if osm2pgsql was compiled with
186184proj support and skip tests accordingly. They also check for the test
187- tablespace ` tablespacetest ` for tests that need tablespaces.
185+ tablespace ` tablespacetest ` for tests that need tablespaces. To force
186+ running the proj and tablespace tests use ` --test-proj yes ` and
187+ ` --test-tablespace yes ` respectively.
188188
189189BDD tests hide print statements by default. For development purposes they
190190can be shown by adding these lines to ` tests/bdd/.behaverc ` :
0 commit comments