pytest-cmake 0.5.1__tar.gz → 0.8.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pytest_cmake-0.5.1 → pytest_cmake-0.8.4}/PKG-INFO +10 -7
- {pytest_cmake-0.5.1 → pytest_cmake-0.8.4}/README.md +5 -6
- {pytest_cmake-0.5.1 → pytest_cmake-0.8.4}/cmake/FindPytest.cmake +36 -23
- {pytest_cmake-0.5.1 → pytest_cmake-0.8.4}/cmake/PytestAddTests.cmake +23 -15
- {pytest_cmake-0.5.1 → pytest_cmake-0.8.4}/pyproject.toml +8 -2
- {pytest_cmake-0.5.1 → pytest_cmake-0.8.4}/setup.py +1 -1
- {pytest_cmake-0.5.1 → pytest_cmake-0.8.4}/.gitignore +0 -0
- {pytest_cmake-0.5.1 → pytest_cmake-0.8.4}/LICENSE +0 -0
- {pytest_cmake-0.5.1 → pytest_cmake-0.8.4}/build_backend.py +0 -0
- {pytest_cmake-0.5.1 → pytest_cmake-0.8.4}/build_config.py +0 -0
| @@ -1,7 +1,11 @@ | |
| 1 1 | 
             
            Metadata-Version: 2.3
         | 
| 2 2 | 
             
            Name: pytest-cmake
         | 
| 3 | 
            -
            Version: 0. | 
| 3 | 
            +
            Version: 0.8.4
         | 
| 4 4 | 
             
            Summary: Provide CMake module for Pytest
         | 
| 5 | 
            +
            Project-URL: Documentation, https://python-cmake.github.io/pytest-cmake
         | 
| 6 | 
            +
            Project-URL: Repository, https://github.com/python-cmake/pytest-cmake
         | 
| 7 | 
            +
            Project-URL: Issues, https://github.com/python-cmake/pytest-cmake/issues
         | 
| 8 | 
            +
            Project-URL: Changelog, https://python-cmake.github.io/pytest-cmake/release/release_notes.html
         | 
| 5 9 | 
             
            Author-email: Jeremy Retailleau <jeremy.retailleau@gmail.com>
         | 
| 6 10 | 
             
            License: MIT License
         | 
| 7 11 |  | 
| @@ -45,9 +49,8 @@ Description-Content-Type: text/markdown | |
| 45 49 | 
             
            # Pytest CMake
         | 
| 46 50 |  | 
| 47 51 | 
             
            [](https://pypi.python.org/pypi/pytest-cmake)
         | 
| 48 | 
            -
            [](https://github.com/buddly27/pytest-cmake/actions/workflows/test.yml)
         | 
| 52 | 
            +
            [](https://cmake.org)
         | 
| 53 | 
            +
            [](https://github.com/python-cmake/pytest-cmake/actions/workflows/test.yml)
         | 
| 51 54 | 
             
            [](https://opensource.org/licenses/MIT)
         | 
| 52 55 |  | 
| 53 56 | 
             
            This project provides convenient ways to use [Pytest](https://docs.pytest.org/)
         | 
| @@ -57,12 +60,12 @@ versions on Linux, macOS or Windows using the | |
| 57 60 | 
             
            function:
         | 
| 58 61 |  | 
| 59 62 | 
             
            ```cmake
         | 
| 60 | 
            -
            find_package(Pytest  | 
| 63 | 
            +
            find_package(Pytest 8.2.1 REQUIRED)
         | 
| 61 64 | 
             
            ```
         | 
| 62 65 |  | 
| 63 66 | 
             
            A ``pytest_discover_tests`` function is provided to simplify automatic
         | 
| 64 67 | 
             
            testing for C++ projects with Python bindings. It can create CTest tests
         | 
| 65 | 
            -
            for each Python test collected within a  | 
| 68 | 
            +
            for each Python test collected within a controlled environment:
         | 
| 66 69 |  | 
| 67 70 | 
             
            ```cmake
         | 
| 68 71 | 
             
            pytest_discover_tests(
         | 
| @@ -92,4 +95,4 @@ Running the tests will display the status for each test collected as follows: | |
| 92 95 | 
             
            ## Documentation
         | 
| 93 96 |  | 
| 94 97 | 
             
            Full documentation, including installation and setup guides, can be found at
         | 
| 95 | 
            -
            https:// | 
| 98 | 
            +
            https://python-cmake.github.io/pytest-cmake/
         | 
| @@ -1,9 +1,8 @@ | |
| 1 1 | 
             
            # Pytest CMake
         | 
| 2 2 |  | 
| 3 3 | 
             
            [](https://pypi.python.org/pypi/pytest-cmake)
         | 
| 4 | 
            -
            [](https://github.com/buddly27/pytest-cmake/actions/workflows/test.yml)
         | 
| 4 | 
            +
            [](https://cmake.org)
         | 
| 5 | 
            +
            [](https://github.com/python-cmake/pytest-cmake/actions/workflows/test.yml)
         | 
| 7 6 | 
             
            [](https://opensource.org/licenses/MIT)
         | 
| 8 7 |  | 
| 9 8 | 
             
            This project provides convenient ways to use [Pytest](https://docs.pytest.org/)
         | 
| @@ -13,12 +12,12 @@ versions on Linux, macOS or Windows using the | |
| 13 12 | 
             
            function:
         | 
| 14 13 |  | 
| 15 14 | 
             
            ```cmake
         | 
| 16 | 
            -
            find_package(Pytest  | 
| 15 | 
            +
            find_package(Pytest 8.2.1 REQUIRED)
         | 
| 17 16 | 
             
            ```
         | 
| 18 17 |  | 
| 19 18 | 
             
            A ``pytest_discover_tests`` function is provided to simplify automatic
         | 
| 20 19 | 
             
            testing for C++ projects with Python bindings. It can create CTest tests
         | 
| 21 | 
            -
            for each Python test collected within a  | 
| 20 | 
            +
            for each Python test collected within a controlled environment:
         | 
| 22 21 |  | 
| 23 22 | 
             
            ```cmake
         | 
| 24 23 | 
             
            pytest_discover_tests(
         | 
| @@ -48,4 +47,4 @@ Running the tests will display the status for each test collected as follows: | |
| 48 47 | 
             
            ## Documentation
         | 
| 49 48 |  | 
| 50 49 | 
             
            Full documentation, including installation and setup guides, can be found at
         | 
| 51 | 
            -
            https:// | 
| 50 | 
            +
            https://python-cmake.github.io/pytest-cmake/
         | 
| @@ -17,7 +17,7 @@ | |
| 17 17 | 
             
            #     prepend a custom search path.
         | 
| 18 18 | 
             
            #     (https://cmake.org/cmake/help/latest/policy/CMP0074.html)
         | 
| 19 19 |  | 
| 20 | 
            -
            cmake_minimum_required(VERSION 3.20...3. | 
| 20 | 
            +
            cmake_minimum_required(VERSION 3.20...3.30)
         | 
| 21 21 |  | 
| 22 22 | 
             
            include(FindPackageHandleStandardArgs)
         | 
| 23 23 |  | 
| @@ -60,50 +60,55 @@ if (Pytest_FOUND AND NOT TARGET Pytest::Pytest) | |
| 60 60 | 
             
                        "LIBRARY_PATH_PREPEND;PYTHON_PATH_PREPEND;ENVIRONMENT;DEPENDS"
         | 
| 61 61 | 
             
                    )
         | 
| 62 62 |  | 
| 63 | 
            -
                    #  | 
| 63 | 
            +
                    # Identify library path environment name depending on the platform.
         | 
| 64 64 | 
             
                    if (CMAKE_SYSTEM_NAME STREQUAL Windows)
         | 
| 65 | 
            -
                        set( | 
| 66 | 
            -
                        set(_env_sep "\\\;")
         | 
| 65 | 
            +
                        set(LIBRARY_ENV_NAME PATH)
         | 
| 67 66 | 
             
                    elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
         | 
| 68 | 
            -
                        set( | 
| 69 | 
            -
                        set(_env_sep ":")
         | 
| 67 | 
            +
                        set(LIBRARY_ENV_NAME DYLD_LIBRARY_PATH)
         | 
| 70 68 | 
             
                    else()
         | 
| 71 | 
            -
                        set( | 
| 72 | 
            -
                        set(_env_sep ":")
         | 
| 69 | 
            +
                        set(LIBRARY_ENV_NAME LD_LIBRARY_PATH)
         | 
| 73 70 | 
             
                    endif()
         | 
| 74 71 |  | 
| 75 | 
            -
                    #  | 
| 76 | 
            -
                    cmake_path(CONVERT "$ENV{${ | 
| 77 | 
            -
                    cmake_path(CONVERT "$ENV{PYTHONPATH}" TO_CMAKE_PATH_LIST  | 
| 72 | 
            +
                    # Sanitize all paths for CMake.
         | 
| 73 | 
            +
                    cmake_path(CONVERT "$ENV{${LIBRARY_ENV_NAME}}" TO_CMAKE_PATH_LIST LIBRARY_PATH)
         | 
| 74 | 
            +
                    cmake_path(CONVERT "$ENV{PYTHONPATH}" TO_CMAKE_PATH_LIST PYTHON_PATH)
         | 
| 78 75 |  | 
| 79 | 
            -
                    # Prepend input path to environment variables
         | 
| 76 | 
            +
                    # Prepend input path to environment variables.
         | 
| 80 77 | 
             
                    if (_LIBRARY_PATH_PREPEND)
         | 
| 81 78 | 
             
                        list(REVERSE _LIBRARY_PATH_PREPEND)
         | 
| 82 79 | 
             
                        foreach (_path ${_LIBRARY_PATH_PREPEND})
         | 
| 83 | 
            -
                            set( | 
| 80 | 
            +
                            set(LIBRARY_PATH "${_path}" "${LIBRARY_PATH}")
         | 
| 84 81 | 
             
                        endforeach()
         | 
| 85 82 | 
             
                    endif()
         | 
| 86 83 |  | 
| 87 84 | 
             
                    if (_PYTHON_PATH_PREPEND)
         | 
| 88 85 | 
             
                        list(REVERSE _PYTHON_PATH_PREPEND)
         | 
| 89 86 | 
             
                        foreach (_path ${_PYTHON_PATH_PREPEND})
         | 
| 90 | 
            -
                            set( | 
| 87 | 
            +
                            set(PYTHON_PATH "${_path}" "${PYTHON_PATH}")
         | 
| 91 88 | 
             
                        endforeach()
         | 
| 92 89 | 
             
                    endif()
         | 
| 93 90 |  | 
| 94 | 
            -
                    #  | 
| 95 | 
            -
                    list(JOIN libpath "${_env_sep}" libpath)
         | 
| 96 | 
            -
                    list(JOIN pythonpath "${_env_sep}" pythonpath)
         | 
| 97 | 
            -
             | 
| 91 | 
            +
                    # Default working directory to current build path if none is provided.
         | 
| 98 92 | 
             
                    if (NOT _WORKING_DIRECTORY)
         | 
| 99 93 | 
             
                        set(_WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
         | 
| 100 94 | 
             
                    endif()
         | 
| 101 95 |  | 
| 96 | 
            +
                    get_filename_component(_WORKING_DIRECTORY "${_WORKING_DIRECTORY}" REALPATH)
         | 
| 97 | 
            +
             | 
| 102 98 | 
             
                    # Override option by environment variable if available.
         | 
| 103 99 | 
             
                    if (DEFINED ENV{BUNDLE_PYTHON_TESTS})
         | 
| 104 100 | 
             
                        set(_BUNDLE_TESTS $ENV{BUNDLE_PYTHON_TESTS})
         | 
| 105 101 | 
             
                    endif()
         | 
| 106 102 |  | 
| 103 | 
            +
            	# Serialize environment if necessary.
         | 
| 104 | 
            +
            	set(ENCODED_ENVIRONMENT "")
         | 
| 105 | 
            +
            	foreach(env ${_ENVIRONMENT})
         | 
| 106 | 
            +
                        string(REPLACE [[\]] [\\]] env ${env})
         | 
| 107 | 
            +
            	    string(REPLACE [[;]] [\\;]] env ${env})
         | 
| 108 | 
            +
            	    list(APPEND ENCODED_ENVIRONMENT ${env})
         | 
| 109 | 
            +
            	endforeach()
         | 
| 110 | 
            +
             | 
| 111 | 
            +
                    set(_include_file "${CMAKE_CURRENT_BINARY_DIR}/${NAME}_include.cmake")
         | 
| 107 112 | 
             
                    set(_tests_file "${CMAKE_CURRENT_BINARY_DIR}/${NAME}_tests.cmake")
         | 
| 108 113 |  | 
| 109 114 | 
             
                    add_custom_target(
         | 
| @@ -114,19 +119,27 @@ if (Pytest_FOUND AND NOT TARGET Pytest::Pytest) | |
| 114 119 | 
             
                        -D "PYTEST_EXECUTABLE=${PYTEST_EXECUTABLE}"
         | 
| 115 120 | 
             
                        -D "TEST_GROUP_NAME=${NAME}"
         | 
| 116 121 | 
             
                        -D "BUNDLE_TESTS=${_BUNDLE_TESTS}"
         | 
| 117 | 
            -
                        -D " | 
| 118 | 
            -
                        -D "LIBRARY_PATH=${ | 
| 119 | 
            -
                        -D "PYTHON_PATH=${ | 
| 122 | 
            +
                        -D "LIBRARY_ENV_NAME=${LIBRARY_ENV_NAME}"
         | 
| 123 | 
            +
                        -D "LIBRARY_PATH=${LIBRARY_PATH}"
         | 
| 124 | 
            +
                        -D "PYTHON_PATH=${PYTHON_PATH}"
         | 
| 120 125 | 
             
                        -D "TRIM_FROM_NAME=${_TRIM_FROM_NAME}"
         | 
| 121 126 | 
             
                        -D "WORKING_DIRECTORY=${_WORKING_DIRECTORY}"
         | 
| 122 | 
            -
             | 
| 127 | 
            +
            	    -D "ENVIRONMENT=${ENCODED_ENVIRONMENT}"
         | 
| 123 128 | 
             
                        -D "PROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR}"
         | 
| 124 129 | 
             
                        -D "CTEST_FILE=${_tests_file}"
         | 
| 125 130 | 
             
                        -P "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/PytestAddTests.cmake")
         | 
| 126 131 |  | 
| 132 | 
            +
                      file(WRITE "${_include_file}"
         | 
| 133 | 
            +
                          "if(EXISTS \"${_tests_file}\")\n"
         | 
| 134 | 
            +
                          "    include(\"${_tests_file}\")\n"
         | 
| 135 | 
            +
                          "else()\n"
         | 
| 136 | 
            +
                          "    add_test(${NAME}_NOT_BUILT ${NAME}_NOT_BUILT)\n"
         | 
| 137 | 
            +
                          "endif()\n"
         | 
| 138 | 
            +
                      )
         | 
| 139 | 
            +
             | 
| 127 140 | 
             
                    # Add discovered tests to directory TEST_INCLUDE_FILES
         | 
| 128 141 | 
             
                    set_property(DIRECTORY
         | 
| 129 | 
            -
                        APPEND PROPERTY TEST_INCLUDE_FILES "${ | 
| 142 | 
            +
                        APPEND PROPERTY TEST_INCLUDE_FILES "${_include_file}")
         | 
| 130 143 |  | 
| 131 144 | 
             
                endfunction()
         | 
| 132 145 |  | 
| @@ -1,25 +1,32 @@ | |
| 1 1 | 
             
            # Wrapper used to create individual CTest tests from Pytest tests.
         | 
| 2 | 
            -
            cmake_minimum_required(VERSION 3.20...3. | 
| 2 | 
            +
            cmake_minimum_required(VERSION 3.20...3.30)
         | 
| 3 3 |  | 
| 4 4 | 
             
            if(CMAKE_SCRIPT_MODE_FILE)
         | 
| 5 5 |  | 
| 6 6 | 
             
                # Set Cmake test file to execute each test.
         | 
| 7 7 | 
             
                set(_content "")
         | 
| 8 8 |  | 
| 9 | 
            -
                 | 
| 10 | 
            -
                 | 
| 11 | 
            -
             | 
| 12 | 
            -
                 | 
| 9 | 
            +
                cmake_path(CONVERT "${LIBRARY_PATH}" TO_NATIVE_PATH_LIST LIBRARY_PATH)
         | 
| 10 | 
            +
                cmake_path(CONVERT "${PYTHON_PATH}" TO_NATIVE_PATH_LIST PYTHON_PATH)
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                # Serialize path values separated by semicolons (required on Windows).
         | 
| 13 | 
            +
                macro(encode_value VARIABLE_NAME)
         | 
| 14 | 
            +
                    string(REPLACE [[\]] [[\\]] ${VARIABLE_NAME} "${${VARIABLE_NAME}}")
         | 
| 15 | 
            +
                    string(REPLACE [[;]] [[\\;]] ${VARIABLE_NAME} "${${VARIABLE_NAME}}")
         | 
| 16 | 
            +
                endmacro()
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                encode_value(LIBRARY_PATH)
         | 
| 19 | 
            +
                encode_value(PYTHON_PATH)
         | 
| 13 20 |  | 
| 14 21 | 
             
                if (BUNDLE_TESTS)
         | 
| 15 22 | 
             
                    string(APPEND _content
         | 
| 16 23 | 
             
                        "add_test(\n"
         | 
| 17 24 | 
             
                        "    \"${TEST_GROUP_NAME}\"\n"
         | 
| 18 | 
            -
                        "    ${PYTEST_EXECUTABLE} \"${WORKING_DIRECTORY}\"\n"
         | 
| 25 | 
            +
                        "    \"${PYTEST_EXECUTABLE}\" \"${WORKING_DIRECTORY}\"\n"
         | 
| 19 26 | 
             
                        ")\n"
         | 
| 20 27 | 
             
                        "set_tests_properties(\n"
         | 
| 21 28 | 
             
                        "     \"${TEST_GROUP_NAME}\" PROPERTIES\n"
         | 
| 22 | 
            -
                        "     ENVIRONMENT \"${ | 
| 29 | 
            +
                        "     ENVIRONMENT \"${LIBRARY_ENV_NAME}=${LIBRARY_PATH}\"\n"
         | 
| 23 30 | 
             
                        ")\n"
         | 
| 24 31 | 
             
                        "set_tests_properties(\n"
         | 
| 25 32 | 
             
                        "     \"${TEST_GROUP_NAME}\"\n"
         | 
| @@ -40,7 +47,7 @@ if(CMAKE_SCRIPT_MODE_FILE) | |
| 40 47 |  | 
| 41 48 | 
             
                else()
         | 
| 42 49 | 
             
                    # Set environment for collecting tests.
         | 
| 43 | 
            -
                    set(ENV{${ | 
| 50 | 
            +
                    set(ENV{${LIBRARY_ENV_NAME}} "${LIBRARY_PATH}")
         | 
| 44 51 | 
             
                    set(ENV{PYTHONPATH} "${PYTHON_PATH}")
         | 
| 45 52 | 
             
                    set(ENV{PYTHONWARNINGS} "ignore")
         | 
| 46 53 |  | 
| @@ -78,28 +85,29 @@ if(CMAKE_SCRIPT_MODE_FILE) | |
| 78 85 | 
             
                        set(_class ${CMAKE_MATCH_3})
         | 
| 79 86 | 
             
                        set(_func ${CMAKE_MATCH_4})
         | 
| 80 87 |  | 
| 88 | 
            +
                        if (TRIM_FROM_NAME)
         | 
| 89 | 
            +
                            set(pattern "${TRIM_FROM_NAME}")
         | 
| 90 | 
            +
                            string(REGEX REPLACE "${pattern}" "" _class "${_class}")
         | 
| 91 | 
            +
                            string(REGEX REPLACE "${pattern}" "" _func "${_func}")
         | 
| 92 | 
            +
                        endif()
         | 
| 93 | 
            +
             | 
| 81 94 | 
             
                        if (_class)
         | 
| 82 95 | 
             
                            set(test_name "${_class}.${_func}")
         | 
| 83 96 | 
             
                        else()
         | 
| 84 97 | 
             
                            set(test_name "${_func}")
         | 
| 85 98 | 
             
                        endif()
         | 
| 86 99 |  | 
| 87 | 
            -
                        if (TRIM_FROM_NAME)
         | 
| 88 | 
            -
                            string(REGEX REPLACE
         | 
| 89 | 
            -
                                    "${TRIM_FROM_NAME}" "" test_name "${test_name}")
         | 
| 90 | 
            -
                        endif()
         | 
| 91 | 
            -
             | 
| 92 100 | 
             
                        set(test_name "${TEST_GROUP_NAME}.${test_name}")
         | 
| 93 101 | 
             
                        set(test_case "${WORKING_DIRECTORY}/${line}")
         | 
| 94 102 |  | 
| 95 103 | 
             
                        string(APPEND _content
         | 
| 96 104 | 
             
                            "add_test(\n"
         | 
| 97 105 | 
             
                            "    \"${test_name}\"\n"
         | 
| 98 | 
            -
                            "    ${PYTEST_EXECUTABLE} \"${test_case}\"\n"
         | 
| 106 | 
            +
                            "    \"${PYTEST_EXECUTABLE}\" \"${test_case}\"\n"
         | 
| 99 107 | 
             
                            ")\n"
         | 
| 100 108 | 
             
                            "set_tests_properties(\n"
         | 
| 101 109 | 
             
                            "     \"${test_name}\" PROPERTIES\n"
         | 
| 102 | 
            -
                            "     ENVIRONMENT \"${ | 
| 110 | 
            +
                            "     ENVIRONMENT \"${LIBRARY_ENV_NAME}=${LIBRARY_PATH}\"\n"
         | 
| 103 111 | 
             
                            ")\n"
         | 
| 104 112 | 
             
                            "set_tests_properties(\n"
         | 
| 105 113 | 
             
                            "     \"${test_name}\"\n"
         | 
| @@ -2,14 +2,14 @@ | |
| 2 2 | 
             
            requires = [
         | 
| 3 3 | 
             
                "hatchling >= 1.4; python_version >= '3'",
         | 
| 4 4 | 
             
                "setuptools >= 44; python_version < '3'",
         | 
| 5 | 
            -
                "cmake >= 3.20, < 3. | 
| 5 | 
            +
                "cmake >= 3.20, < 3.31"
         | 
| 6 6 | 
             
            ]
         | 
| 7 7 | 
             
            build-backend = "build_backend"
         | 
| 8 8 | 
             
            backend-path = ["."]
         | 
| 9 9 |  | 
| 10 10 | 
             
            [project]
         | 
| 11 11 | 
             
            name = "pytest-cmake"
         | 
| 12 | 
            -
            version = "0. | 
| 12 | 
            +
            version = "0.8.4"
         | 
| 13 13 | 
             
            description = "Provide CMake module for Pytest"
         | 
| 14 14 | 
             
            readme = "README.md"
         | 
| 15 15 | 
             
            requires-python = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, <4"
         | 
| @@ -36,6 +36,12 @@ classifiers = [ | |
| 36 36 | 
             
                "Programming Language :: Python :: 3.12",
         | 
| 37 37 | 
             
            ]
         | 
| 38 38 |  | 
| 39 | 
            +
            [project.urls]
         | 
| 40 | 
            +
            Documentation = "https://python-cmake.github.io/pytest-cmake"
         | 
| 41 | 
            +
            Repository = "https://github.com/python-cmake/pytest-cmake"
         | 
| 42 | 
            +
            Issues = "https://github.com/python-cmake/pytest-cmake/issues"
         | 
| 43 | 
            +
            Changelog = "https://python-cmake.github.io/pytest-cmake/release/release_notes.html"
         | 
| 44 | 
            +
             | 
| 39 45 | 
             
            [tool.hatch.build.hooks.custom]
         | 
| 40 46 | 
             
            require-runtime-dependencies = true
         | 
| 41 47 | 
             
            path = "build_config.py"
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         |