Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Changes:
* Update Python packaging: move `setup.cfg` metadata to `pyproject.toml` ([#207](https://github.com/xcsf-dev/xcsf/pull/207))
* Fix macOS building with AppleClang ([#210](https://github.com/xcsf-dev/xcsf/pull/210))
* Add support for Python 3.14 ([#211](https://github.com/xcsf-dev/xcsf/pull/211))
* Update pybind11 to v3.0.1 and doctest to v2.4.12 ([#212](https://github.com/xcsf-dev/xcsf/pull/212))

## Version 1.4.7 (Aug 19, 2024)

Expand Down
14 changes: 13 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -178,31 +178,43 @@ if(XCSF_PYLIB)
file(COPY ${PYTHON_EXAMPLES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY "xcsf/utils/" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/xcsf/utils/)
file(COPY "xcsf/__init__.py" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/xcsf/)

if(PYTEST)
# Copy the Python tests
file(GLOB PYTHON_TESTS "test/python/*.py")
file(COPY ${PYTHON_TESTS} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})

# Check Python executable has been found
if(NOT Python_EXECUTABLE)
message(FATAL_ERROR "Python_EXECUTABLE is not set")
endif()

# Create a virtual environment
set(VENV_DIR "${CMAKE_CURRENT_BINARY_DIR}/venv")
execute_process(COMMAND "${PYTHON_EXECUTABLE}" -m venv "${VENV_DIR}")
execute_process(COMMAND "${Python_EXECUTABLE}" -m venv "${VENV_DIR}")

# Activate the virtual environment
if(WIN32)
set(PYTHON_EXEC "${VENV_DIR}/Scripts/python")
else()
set(PYTHON_EXEC "${VENV_DIR}/bin/python")
endif()

# Install dependencies
execute_process(
COMMAND "${PYTHON_EXEC}" -m pip install pytest numpy scikit-learn
)

# Add pytest to ctest (to capture CI failures)
add_test(NAME pytest COMMAND "${PYTHON_EXEC}" -m pytest .)

# Execute pytest at the end of building
add_custom_target(run_tests ALL
COMMAND "${PYTHON_EXEC}" -m pytest .
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Running pytest..."
)

# Wait for XCSF to be built
add_dependencies(run_tests xcsf)
endif()
Expand Down
2 changes: 1 addition & 1 deletion lib/doctest
2 changes: 1 addition & 1 deletion lib/pybind11
Submodule pybind11 updated 271 files
Loading