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 test skipping logic for missing pytest module #441

Merged
merged 1 commit into from Apr 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion ament_cmake_pytest/CMakeLists.txt
Expand Up @@ -20,6 +20,7 @@ if(BUILD_TESTING)

# Check if pytest is available
set(check_pytest_cmd "${python_interpreter}" "-m" "pytest" "--version")
set(SKIP_TEST_ARG "")
execute_process(
COMMAND ${check_pytest_cmd}
RESULT_VARIABLE res
Expand All @@ -30,7 +31,7 @@ if(BUILD_TESTING)
"The Python module 'pytest' was not found, pytests cannot be run. "
"On Linux, install the 'python3-pytest' package. "
"On other platforms, install 'pytest' using pip.")
return()
set(SKIP_TEST_ARG SKIP_TEST)
endif()

set(result_file "${AMENT_TEST_RESULTS_DIR}/${PROJECT_NAME}/pytest.xunit.xml")
Expand All @@ -51,6 +52,7 @@ if(BUILD_TESTING)
COMMAND ${cmd}
OUTPUT_FILE "${CMAKE_BINARY_DIR}/ament_cmake_pytest/pytest.txt"
RESULT_FILE "${result_file}"
${SKIP_TEST_ARG}
)
set_tests_properties(
pytest
Expand Down