Skip to content

Commit

Permalink
add cmake command to run GTSAM python tests
Browse files Browse the repository at this point in the history
  • Loading branch information
varunagrawal committed Jun 13, 2021
1 parent 342ab73 commit 52bf1cd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
10 changes: 10 additions & 0 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,13 @@ add_custom_target(${GTSAM_PYTHON_INSTALL_TARGET}
COMMAND ${PYTHON_EXECUTABLE} ${GTSAM_PYTHON_BUILD_DIRECTORY}/setup.py install
DEPENDS ${GTSAM_PYTHON_DEPENDENCIES}
WORKING_DIRECTORY ${GTSAM_PYTHON_BUILD_DIRECTORY})

# Custom make command to run all GTSAM Python tests
add_custom_target(
python-test
COMMAND
${CMAKE_COMMAND} -E env # add package to python path so no need to install
"PYTHONPATH=${GTSAM_PYTHON_BUILD_DIRECTORY}/$ENV{PYTHONPATH}"
${PYTHON_EXECUTABLE} -m unittest discover
DEPENDS ${GTSAM_PYTHON_DEPENDENCIES}
WORKING_DIRECTORY ${GTSAM_PYTHON_BUILD_DIRECTORY}/gtsam/tests)
8 changes: 2 additions & 6 deletions python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,8 @@ For instructions on updating the version of the [wrap library](https://github.co
## Unit Tests
The Python toolbox also has a small set of unit tests located in the
test directory. To run them:
```bash
cd <GTSAM_SOURCE_DIRECTORY>/python/gtsam/tests
python -m unittest discover
```
test directory.
To run them, use `make python-test`.
## Utils
Expand Down

0 comments on commit 52bf1cd

Please sign in to comment.