Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PYTHONPATH for tests when using a venv #1208

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion test/unit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,13 @@ target_link_libraries(testunitparser PRIVATE lexer test_util config)
# Use catch_discover instead of add_test for granular test result reporting.
# =============================================================================
set(test_env ${NMODL_SANITIZER_ENABLE_ENVIRONMENT})
set(testvisitor_env "PYTHONPATH=${PROJECT_BINARY_DIR}/lib:$ENV{PYTHONPATH}")
# workaround for when the user installs all Python dependencies in a virtual env
execute_process(
COMMAND ${PYTHON_EXECUTABLE} -c "import sysconfig; print(sysconfig.get_path('purelib'))"
OUTPUT_VARIABLE PYTHON_PURELIB_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(testvisitor_env "PYTHONPATH=${PROJECT_BINARY_DIR}/lib:${PYTHON_PURELIB_PATH}:$ENV{PYTHONPATH}")

if(NOT LINK_AGAINST_PYTHON)
list(APPEND testvisitor_env "NMODL_PYLIB=$ENV{NMODL_PYLIB}")
endif()
Expand Down
Loading