Skip to content

Commit 20a270f

Browse files
committed
adapt test documentation for new runner
1 parent 5818599 commit 20a270f

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

CONTRIBUTING.md

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -143,18 +143,21 @@ BDD tests you need to have behave and psycopg installed. On Ubuntu run:
143143
sudo 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+
146150
There are ctest directives to run the tests. If you want to run the tests
147151
manually, 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-
158161
To make this a bit easier a shell script `run-behave` is provided in your
159162
build directory which sets those correct paths and calls `behave`. If run
160163
with `-p` as first option it will wrap the call to `behave` in a call to
@@ -165,26 +168,28 @@ To run a single test, simply add the name of the test file, followed by a
165168
column and the line number of the test:
166169

167170
```sh
168-
behave flex/area.feature:71
171+
./run-bdd-tests ../tests/bdd/flex/area.feature:71
169172
```
170173

171174
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.
175+
`--keep-test-db` and behave won't remove the database after the test is
176+
finished. This makes only sense, when running a single test.
174177
When running under pg_virtualenv, don't forget to keep the virtual environment
175178
as well. You can use the handy `-s` switch:
176179

177180
```sh
178-
pg_virtualenv -s behave -DKEEP_TEST_DB flex/area.feature:71
181+
pg_virtualenv -s ./run-bdd-tests ../tests/bdd/flex/area.feature:71
179182
```
180183

181184
It drops you into a shell when the behave test fails, where you can use
182185
psql to look at the database. Or start a shell in the virtual environment
183186
with `pg_virtualenv bash` and run behave from there.
184187

185-
The BDDs automatically detect if osm2pgsql was compiled with Lua and
188+
The BDDs automatically detect if osm2pgsql was compiled with
186189
proj support and skip tests accordingly. They also check for the test
187-
tablespace `tablespacetest` for tests that need tablespaces.
190+
tablespace `tablespacetest` for tests that need tablespaces. To force
191+
running the proj and tablespace tests use `--test-proj yes` and
192+
`--test-tablespace yes` respectively.
188193

189194
BDD tests hide print statements by default. For development purposes they
190195
can be shown by adding these lines to `tests/bdd/.behaverc`:

0 commit comments

Comments
 (0)