pytest-cmake


Namepytest-cmake JSON
Version 0.5.1 PyPI version JSON
download
home_page
SummaryProvide CMake module for Pytest
upload_time2024-03-18 02:56:27
maintainer
docs_urlNone
author
requires_python!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,<4,>=2.7
licenseMIT License Copyright (c) 2022 Jeremy Retailleau Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords cmake development pytest
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Pytest CMake

[![PyPi version](https://img.shields.io/pypi/v/pytest-cmake.svg?logo=pypi&label=PyPI&logoColor=gold)](https://pypi.python.org/pypi/pytest-cmake)
[![CMake](https://img.shields.io/badge/CMake-3.20...3.29-blue.svg?logo=CMake&logoColor=blue)](https://cmake.org)
[![Documentation](https://readthedocs.org/projects/pytest-cmake/badge/?version=stable)](https://pytest-cmake.readthedocs.io/en/stable/)
[![Test](https://github.com/buddly27/pytest-cmake/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/buddly27/pytest-cmake/actions/workflows/test.yml)
[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

This project provides convenient ways to use [Pytest](https://docs.pytest.org/)
within a [CMake](https://cmake.org/) project. The package can be discovered from a specific range of
versions on Linux, macOS or Windows using the
[find_package](https://cmake.org/cmake/help/latest/command/find_package.html)
function:

```cmake
find_package(Pytest 4.6.11 REQUIRED)
```

A ``pytest_discover_tests`` function is provided to simplify automatic
testing for C++ projects with Python bindings. It can create CTest tests
for each Python test collected within a correct environment:

```cmake
pytest_discover_tests(
    PythonTest
    LIBRARY_PATH_PREPEND
        $<TARGET_FILE_DIR:MyLibrary>
    PYTHON_PATH_PREPEND
        $<TARGET_FILE_DIR:MyLibrary>
    TRIM_FROM_NAME "^test_"
    DEPENDS MyLibrary
)
```

Running the tests will display the status for each test collected as follows:

```console
    Start 1: PythonTest.greet_world
1/4 Test #1: PythonTest.greet_world ...........   Passed    0.47 sec
    Start 2: PythonTest.greet_john
2/4 Test #2: PythonTest.greet_john ............   Passed    0.47 sec
    Start 3: PythonTest.greet_julia
3/4 Test #3: PythonTest.greet_julia ...........   Passed    0.47 sec
    Start 4: PythonTest.greet_michael
4/4 Test #4: PythonTest.greet_michael .........   Passed    0.54 sec
```

## Documentation

Full documentation, including installation and setup guides, can be found at
https://pytest-cmake.readthedocs.io/en/stable/

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "pytest-cmake",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,<4,>=2.7",
    "maintainer_email": "",
    "keywords": "cmake,development,pytest",
    "author": "",
    "author_email": "Jeremy Retailleau <jeremy.retailleau@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/8e/82/6e8a726ab2ab22b45c9948bed487f8386873a5a9e81041023bb73f2fde6f/pytest_cmake-0.5.1.tar.gz",
    "platform": null,
    "description": "# Pytest CMake\n\n[![PyPi version](https://img.shields.io/pypi/v/pytest-cmake.svg?logo=pypi&label=PyPI&logoColor=gold)](https://pypi.python.org/pypi/pytest-cmake)\n[![CMake](https://img.shields.io/badge/CMake-3.20...3.29-blue.svg?logo=CMake&logoColor=blue)](https://cmake.org)\n[![Documentation](https://readthedocs.org/projects/pytest-cmake/badge/?version=stable)](https://pytest-cmake.readthedocs.io/en/stable/)\n[![Test](https://github.com/buddly27/pytest-cmake/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/buddly27/pytest-cmake/actions/workflows/test.yml)\n[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nThis project provides convenient ways to use [Pytest](https://docs.pytest.org/)\nwithin a [CMake](https://cmake.org/) project. The package can be discovered from a specific range of\nversions on Linux, macOS or Windows using the\n[find_package](https://cmake.org/cmake/help/latest/command/find_package.html)\nfunction:\n\n```cmake\nfind_package(Pytest 4.6.11 REQUIRED)\n```\n\nA ``pytest_discover_tests`` function is provided to simplify automatic\ntesting for C++ projects with Python bindings. It can create CTest tests\nfor each Python test collected within a correct environment:\n\n```cmake\npytest_discover_tests(\n    PythonTest\n    LIBRARY_PATH_PREPEND\n        $<TARGET_FILE_DIR:MyLibrary>\n    PYTHON_PATH_PREPEND\n        $<TARGET_FILE_DIR:MyLibrary>\n    TRIM_FROM_NAME \"^test_\"\n    DEPENDS MyLibrary\n)\n```\n\nRunning the tests will display the status for each test collected as follows:\n\n```console\n    Start 1: PythonTest.greet_world\n1/4 Test #1: PythonTest.greet_world ...........   Passed    0.47 sec\n    Start 2: PythonTest.greet_john\n2/4 Test #2: PythonTest.greet_john ............   Passed    0.47 sec\n    Start 3: PythonTest.greet_julia\n3/4 Test #3: PythonTest.greet_julia ...........   Passed    0.47 sec\n    Start 4: PythonTest.greet_michael\n4/4 Test #4: PythonTest.greet_michael .........   Passed    0.54 sec\n```\n\n## Documentation\n\nFull documentation, including installation and setup guides, can be found at\nhttps://pytest-cmake.readthedocs.io/en/stable/\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2022 Jeremy Retailleau  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "Provide CMake module for Pytest",
    "version": "0.5.1",
    "project_urls": null,
    "split_keywords": [
        "cmake",
        "development",
        "pytest"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8e826e8a726ab2ab22b45c9948bed487f8386873a5a9e81041023bb73f2fde6f",
                "md5": "a71b0743b8721c2d60c6478e48136dbf",
                "sha256": "b0787508888715fed4b87416608bc72aefac0e08932b52a53bac30ef18d18cfe"
            },
            "downloads": -1,
            "filename": "pytest_cmake-0.5.1.tar.gz",
            "has_sig": false,
            "md5_digest": "a71b0743b8721c2d60c6478e48136dbf",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,<4,>=2.7",
            "size": 6479,
            "upload_time": "2024-03-18T02:56:27",
            "upload_time_iso_8601": "2024-03-18T02:56:27.752121Z",
            "url": "https://files.pythonhosted.org/packages/8e/82/6e8a726ab2ab22b45c9948bed487f8386873a5a9e81041023bb73f2fde6f/pytest_cmake-0.5.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-18 02:56:27",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "pytest-cmake"
}
        
Elapsed time: 0.22277s