Skip to content

Commit 9c2330b

Browse files
author
Grok Compression
committed
INSTALL: add section on python test rig
1 parent 6c3a5b4 commit 9c2330b

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

INSTALL.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,31 @@ If the `-DGRK_DATA_ROOT:PATH` option is omitted,
190190
test files will be automatically searched for in
191191
`${CMAKE_SOURCE_DIR}/../grok-test-data`
192192

193+
### Python Tests
194+
195+
Python tests are automatically enabled when `BUILD_TESTING=ON` and SWIG bindings are built
196+
(`GRK_BUILD_CORE_SWIG_BINDINGS=ON`). They require [pytest](https://docs.pytest.org/) to be installed.
197+
198+
To run the Python tests via `ctest`:
199+
200+
$ cd /PATH/TO/BUILD
201+
$ ctest -R python_tests -V
202+
203+
To run them directly with `pytest`:
204+
205+
$ cd /PATH/TO/BUILD/bin
206+
$ PYTHONPATH=/PATH/TO/BUILD/bin python -m pytest /PATH/TO/SOURCE/tests/python -v --tb=short
207+
208+
To run a single test file:
209+
210+
$ cd /PATH/TO/BUILD/bin
211+
$ PYTHONPATH=/PATH/TO/BUILD/bin python -m pytest /PATH/TO/SOURCE/tests/python/test_roundtrip.py -v
212+
213+
Note: if the build has address sanitizer enabled (`-DWITH_SANITIZER=Address`),
214+
Python tests will fail because the ASAN runtime must be loaded before Python.
215+
Either rebuild without ASAN (`-DWITH_SANITIZER=OFF`) or preload the runtime:
216+
217+
$ LD_PRELOAD=$(gcc -print-file-name=libasan.so) PYTHONPATH=/PATH/TO/BUILD/bin python -m pytest ...
193218

194219
## macOS
195220

0 commit comments

Comments
 (0)