diff options
author | Martin Braun <martin.braun@ettus.com> | 2021-09-03 11:02:54 +0200 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2021-09-08 11:42:17 -0500 |
commit | fd2ff73b820079e4670f1348c5ab8f5c61143b34 (patch) | |
tree | b3b1570d46f52a7fc940515e33a81d68cf30bb06 | |
parent | 11a20a10c78d494036ef2edf4d6197bbb59dd3fc (diff) | |
download | uhd-fd2ff73b820079e4670f1348c5ab8f5c61143b34.tar.gz uhd-fd2ff73b820079e4670f1348c5ab8f5c61143b34.tar.bz2 uhd-fd2ff73b820079e4670f1348c5ab8f5c61143b34.zip |
cmake: tests: Add build-python path to PYTHONPATH
This is more of an expressive change than a functional change; Python
seems to add this path to the PYTHONPATH anyway, at least for some
systems. We neverless make this change because:
- It's more explicit/expressive. When tests are run, the PYTHONPATH env
variable is printed, and it now contains this path where it should be,
right at the front. People reading the ctest/python.unittest output
now get told explicitly which path we mean.
- This guarantees that this path is added, even if Python/unittest
should behave differently on other systems or versions.
To clarify: When running unit tests, we want to run the Python code from
build/python, not the installed version. The latter may not yet exist,
and if it does, it's not the version we are editing.
-rw-r--r-- | host/cmake/Modules/UHDUnitTest.cmake | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/host/cmake/Modules/UHDUnitTest.cmake b/host/cmake/Modules/UHDUnitTest.cmake index 519be9ca0..4e6651fd9 100644 --- a/host/cmake/Modules/UHDUnitTest.cmake +++ b/host/cmake/Modules/UHDUnitTest.cmake @@ -133,9 +133,12 @@ function(UHD_ADD_PYTEST test_name) # Include ${CMAKE_BINARY_DIR}/utils/ for testing the python utils if(APPLE) set_tests_properties(${test_name} PROPERTIES - ENVIRONMENT "DYLD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib/;PYTHONPATH=${CMAKE_SOURCE_DIR}/tests/common:${CMAKE_BINARY_DIR}/utils/") + ENVIRONMENT + "DYLD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib/;PYTHONPATH=${UHD_BINARY_DIR}/python:${CMAKE_SOURCE_DIR}/tests/common:${CMAKE_BINARY_DIR}/utils/") else() set_tests_properties(${test_name} PROPERTIES - ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib/;PYTHONPATH=${CMAKE_SOURCE_DIR}/tests/common:${CMAKE_BINARY_DIR}/utils/") + ENVIRONMENT + "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib/;PYTHONPATH=${UHD_BINARY_DIR}/python:${CMAKE_SOURCE_DIR}/tests/common:${CMAKE_BINARY_DIR}/utils/" + ) endif() endfunction(UHD_ADD_PYTEST) |