From a793976e84f070b8ce06a038ae69e925f0086962 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Fri, 5 Jun 2015 20:27:38 +0300 Subject: [PATCH 01/47] Initial relayouting. --- cov-core/.gitignore | 6 ------ cov-core/LICENSE.txt | 21 ------------------- cov-core/MANIFEST.in | 5 ----- cov-core/README.rst | 5 ----- setup.py | 3 --- src/pytest_cover/__init__.py | 1 + .../pytest_cover/embed.py | 0 .../cov_core.py => src/pytest_cover/engine.py | 0 .../pytest_cover/plugin.py | 0 9 files changed, 1 insertion(+), 40 deletions(-) delete mode 100644 cov-core/.gitignore delete mode 100644 cov-core/LICENSE.txt delete mode 100644 cov-core/MANIFEST.in delete mode 100644 cov-core/README.rst delete mode 100644 setup.py create mode 100644 src/pytest_cover/__init__.py rename cov-core/cov_core_init.py => src/pytest_cover/embed.py (100%) rename cov-core/cov_core.py => src/pytest_cover/engine.py (100%) rename pytest-cov/pytest_cov.py => src/pytest_cover/plugin.py (100%) diff --git a/cov-core/.gitignore b/cov-core/.gitignore deleted file mode 100644 index 46a6d937..00000000 --- a/cov-core/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.pyo -*.pyc -*egg-info -build -dist -env* diff --git a/cov-core/LICENSE.txt b/cov-core/LICENSE.txt deleted file mode 100644 index 5b3634b4..00000000 --- a/cov-core/LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License - -Copyright (c) 2010 Meme Dough - -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. diff --git a/cov-core/MANIFEST.in b/cov-core/MANIFEST.in deleted file mode 100644 index 9ad66a9b..00000000 --- a/cov-core/MANIFEST.in +++ /dev/null @@ -1,5 +0,0 @@ -include README.rst -include LICENSE.txt -include setup.py -include cov_core.py -include cov_core_init.py diff --git a/cov-core/README.rst b/cov-core/README.rst deleted file mode 100644 index 1a41daf2..00000000 --- a/cov-core/README.rst +++ /dev/null @@ -1,5 +0,0 @@ -cov-core -======== - -This is a lib package for use by pytest-cov, nose-cov and nose2-cov. Unless you're developing a -coverage plugin for a test framework, you probably want one of those. diff --git a/setup.py b/setup.py deleted file mode 100644 index 60684932..00000000 --- a/setup.py +++ /dev/null @@ -1,3 +0,0 @@ -from setuptools import setup - -setup() diff --git a/src/pytest_cover/__init__.py b/src/pytest_cover/__init__.py new file mode 100644 index 00000000..3dc1f76b --- /dev/null +++ b/src/pytest_cover/__init__.py @@ -0,0 +1 @@ +__version__ = "0.1.0" diff --git a/cov-core/cov_core_init.py b/src/pytest_cover/embed.py similarity index 100% rename from cov-core/cov_core_init.py rename to src/pytest_cover/embed.py diff --git a/cov-core/cov_core.py b/src/pytest_cover/engine.py similarity index 100% rename from cov-core/cov_core.py rename to src/pytest_cover/engine.py diff --git a/pytest-cov/pytest_cov.py b/src/pytest_cover/plugin.py similarity index 100% rename from pytest-cov/pytest_cov.py rename to src/pytest_cover/plugin.py From 906926dddde6e4286e672cc55f0ea193a10d45eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Fri, 5 Jun 2015 20:27:59 +0300 Subject: [PATCH 02/47] Move this. --- pytest-cov/setup.py => setup.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename pytest-cov/setup.py => setup.py (100%) diff --git a/pytest-cov/setup.py b/setup.py similarity index 100% rename from pytest-cov/setup.py rename to setup.py From ebc6a991a3726820b9bd0a410f84b795842939dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Fri, 5 Jun 2015 20:32:38 +0300 Subject: [PATCH 03/47] More relayouting --- README.rst | 7 ---- {example-tox-project => example}/.coveragerc | 0 .../mylib/__init__.py | 0 {example-tox-project => example}/setup.py | 0 .../tests/test_mylib.py | 0 {example-tox-project => example}/tox.ini | 0 pytest-cov/.gitignore | 8 ----- pytest-cov/LICENSE.txt | 21 ------------ pytest-cov/MANIFEST.in | 5 --- pytest-cov/tox.ini | 14 -------- setup.py | 32 ------------------- .../test_pytest_cover.py | 0 12 files changed, 87 deletions(-) delete mode 100644 README.rst rename {example-tox-project => example}/.coveragerc (100%) rename {example-tox-project => example}/mylib/__init__.py (100%) rename {example-tox-project => example}/setup.py (100%) rename {example-tox-project => example}/tests/test_mylib.py (100%) rename {example-tox-project => example}/tox.ini (100%) delete mode 100644 pytest-cov/.gitignore delete mode 100644 pytest-cov/LICENSE.txt delete mode 100644 pytest-cov/MANIFEST.in delete mode 100644 pytest-cov/tox.ini delete mode 100644 setup.py rename pytest-cov/test_pytest_cov.py => tests/test_pytest_cover.py (100%) diff --git a/README.rst b/README.rst deleted file mode 100644 index 4edbedcb..00000000 --- a/README.rst +++ /dev/null @@ -1,7 +0,0 @@ -py-cov -====== - -Collection of Python coverage projects. - -- pytest-cov -- cov-core diff --git a/example-tox-project/.coveragerc b/example/.coveragerc similarity index 100% rename from example-tox-project/.coveragerc rename to example/.coveragerc diff --git a/example-tox-project/mylib/__init__.py b/example/mylib/__init__.py similarity index 100% rename from example-tox-project/mylib/__init__.py rename to example/mylib/__init__.py diff --git a/example-tox-project/setup.py b/example/setup.py similarity index 100% rename from example-tox-project/setup.py rename to example/setup.py diff --git a/example-tox-project/tests/test_mylib.py b/example/tests/test_mylib.py similarity index 100% rename from example-tox-project/tests/test_mylib.py rename to example/tests/test_mylib.py diff --git a/example-tox-project/tox.ini b/example/tox.ini similarity index 100% rename from example-tox-project/tox.ini rename to example/tox.ini diff --git a/pytest-cov/.gitignore b/pytest-cov/.gitignore deleted file mode 100644 index cbb44d89..00000000 --- a/pytest-cov/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -*.pyo -*.pyc -*egg-info -build -dist -env* -.tox -.coverage* diff --git a/pytest-cov/LICENSE.txt b/pytest-cov/LICENSE.txt deleted file mode 100644 index 5b3634b4..00000000 --- a/pytest-cov/LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License - -Copyright (c) 2010 Meme Dough - -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. diff --git a/pytest-cov/MANIFEST.in b/pytest-cov/MANIFEST.in deleted file mode 100644 index 99e6799f..00000000 --- a/pytest-cov/MANIFEST.in +++ /dev/null @@ -1,5 +0,0 @@ -include README.rst -include LICENSE.txt -include setup.py -include pytest_cov.py -include test_pytest_cov.py diff --git a/pytest-cov/tox.ini b/pytest-cov/tox.ini deleted file mode 100644 index 830ea8d0..00000000 --- a/pytest-cov/tox.ini +++ /dev/null @@ -1,14 +0,0 @@ -[tox] -envlist = py26, py27, pypy, pypy3, py32, py33, py34 - -[testenv] -usedevelop = True -setenv = - PYTHONHASHSEED = random -deps = - {env:COV_CORE_DEP:../cov-core} - execnet>=1.2.0,<1.3.0 - pytest>=2.6.4,<2.7.0 - pytest-xdist - virtualenv -commands = py.test -v test_pytest_cov.py {posargs} diff --git a/setup.py b/setup.py deleted file mode 100644 index ec7623a5..00000000 --- a/setup.py +++ /dev/null @@ -1,32 +0,0 @@ -import setuptools - -setuptools.setup(name='pytest-cov', - version='1.8.1', - description='py.test plugin for coverage reporting with ' - 'support for both centralised and distributed testing, ' - 'including subprocesses and multiprocessing', - long_description=open('README.rst').read().strip(), - author='Marc Schlaich', - author_email='marc.schlaich@gmail.com', - url='https://github.com/schlamar/pytest-cov', - py_modules=['pytest_cov'], - install_requires=['py>=1.4.22', - 'pytest>=2.6.0', - 'coverage>=3.7.1', - 'cov-core>=1.14.0'], - entry_points={'pytest11': ['pytest_cov = pytest_cov']}, - license='MIT License', - zip_safe=False, - keywords='py.test pytest cover coverage distributed parallel', - classifiers=['Development Status :: 4 - Beta', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Python :: 2.4', - 'Programming Language :: Python :: 2.5', - 'Programming Language :: Python :: 2.6', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3.0', - 'Programming Language :: Python :: 3.1', - 'Topic :: Software Development :: Testing']) diff --git a/pytest-cov/test_pytest_cov.py b/tests/test_pytest_cover.py similarity index 100% rename from pytest-cov/test_pytest_cov.py rename to tests/test_pytest_cover.py From ecdf3bfe3618e6d139dc59c1873b7b84660c9562 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Fri, 5 Jun 2015 20:34:28 +0300 Subject: [PATCH 04/47] Complete project structure. --- .coveragerc | 12 +++ .gitignore | 58 +++++++++++++- .travis.yml | 60 ++++++-------- AUTHORS.rst | 5 ++ CHANGELOG.rst | 8 ++ CONTRIBUTING.rst | 89 +++++++++++++++++++++ LICENSE | 19 +++++ MANIFEST.in | 21 +++++ pytest-cov/README.rst => README.rst | 0 appveyor.yml | 96 +++++++++++++++++++++++ ci/appveyor-bootstrap.ps1 | 88 +++++++++++++++++++++ ci/appveyor-with-compiler.cmd | 37 +++++++++ ci/bootstrap.py | 64 +++++++++++++++ ci/templates/.travis.yml | 27 +++++++ ci/templates/appveyor.yml | 39 ++++++++++ ci/templates/tox.ini | 117 ++++++++++++++++++++++++++++ docs/authors.rst | 1 + docs/changelog.rst | 1 + docs/conf.py | 44 +++++++++++ docs/contributing.rst | 1 + docs/index.rst | 23 ++++++ docs/installation.rst | 7 ++ docs/readme.rst | 5 ++ docs/reference/index.rst | 7 ++ docs/reference/pytest_cover.rst | 5 ++ docs/requirements.txt | 4 + docs/spelling_wordlist.txt | 11 +++ docs/usage.rst | 7 ++ setup.cfg | 86 ++++++++++++++++++++ cov-core/setup.py => setup.py | 0 tox.ini | 116 +++++++++++++++++++++++++-- 31 files changed, 1013 insertions(+), 45 deletions(-) create mode 100644 .coveragerc create mode 100644 AUTHORS.rst create mode 100644 CHANGELOG.rst create mode 100644 CONTRIBUTING.rst create mode 100644 LICENSE create mode 100644 MANIFEST.in rename pytest-cov/README.rst => README.rst (100%) create mode 100644 appveyor.yml create mode 100644 ci/appveyor-bootstrap.ps1 create mode 100644 ci/appveyor-with-compiler.cmd create mode 100755 ci/bootstrap.py create mode 100644 ci/templates/.travis.yml create mode 100644 ci/templates/appveyor.yml create mode 100644 ci/templates/tox.ini create mode 100644 docs/authors.rst create mode 100644 docs/changelog.rst create mode 100644 docs/conf.py create mode 100644 docs/contributing.rst create mode 100644 docs/index.rst create mode 100644 docs/installation.rst create mode 100644 docs/readme.rst create mode 100644 docs/reference/index.rst create mode 100644 docs/reference/pytest_cover.rst create mode 100644 docs/requirements.txt create mode 100644 docs/spelling_wordlist.txt create mode 100644 docs/usage.rst create mode 100644 setup.cfg rename cov-core/setup.py => setup.py (100%) diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 00000000..772866d2 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,12 @@ +[paths] +source = src + +[run] +branch = True +source = src +parallel = true + +[report] +show_missing = true +precision = 2 +omit = *migrations* diff --git a/.gitignore b/.gitignore index 0fbfbd25..88b9214b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,57 @@ -.tox/ -*.egg-info/ +*.py[cod] + +# C extensions +*.so + +# Packages +*.egg +*.egg-info +dist +build +eggs +parts +bin +var +sdist +develop-eggs +.installed.cfg +lib +lib64 +venv*/ +pyvenv*/ + +# Installer logs +pip-log.txt + +# Unit test / coverage reports .coverage +.tox .coverage.* -*.pyc \ No newline at end of file +nosetests.xml +htmlcov + +# Translations +*.mo + +# Mr Developer +.mr.developer.cfg +.project +.pydevproject +.idea +*.iml +*.komodoproject + +# Complexity +output/*.html +output/*/index.html + +# Sphinx +docs/_build + +.DS_Store +*~ +.*.sw[po] +.build +.ve +.bootstrap +*.bak diff --git a/.travis.yml b/.travis.yml index f09d0e10..80caf6f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,45 +1,33 @@ language: python - python: 2.7 - -env: - - CWD=. TOX_ENV=flake8 - - - CWD=pytest-cov TOX_ENV=pypy COV_CORE_DEP=../cov-core - - CWD=pytest-cov TOX_ENV=pypy3 COV_CORE_DEP=../cov-core - - CWD=pytest-cov TOX_ENV=py26 COV_CORE_DEP=../cov-core - - CWD=pytest-cov TOX_ENV=py27 COV_CORE_DEP=../cov-core - - CWD=pytest-cov TOX_ENV=py32 COV_CORE_DEP=../cov-core - - CWD=pytest-cov TOX_ENV=py33 COV_CORE_DEP=../cov-core - - CWD=pytest-cov TOX_ENV=py34 COV_CORE_DEP=../cov-core - - - CWD=pytest-cov TOX_ENV=pypy COV_CORE_DEP=cov-core - - CWD=pytest-cov TOX_ENV=pypy3 COV_CORE_DEP=cov-core - - CWD=pytest-cov TOX_ENV=py26 COV_CORE_DEP=cov-core - - CWD=pytest-cov TOX_ENV=py27 COV_CORE_DEP=cov-core - - CWD=pytest-cov TOX_ENV=py32 COV_CORE_DEP=cov-core - - CWD=pytest-cov TOX_ENV=py33 COV_CORE_DEP=cov-core - - CWD=pytest-cov TOX_ENV=py34 COV_CORE_DEP=cov-core - -matrix: - allow_failures: - - env: CWD=pytest-cov TOX_ENV=pypy COV_CORE_DEP=cov-core - - env: CWD=pytest-cov TOX_ENV=pypy3 COV_CORE_DEP=cov-core - - env: CWD=pytest-cov TOX_ENV=py26 COV_CORE_DEP=cov-core - - env: CWD=pytest-cov TOX_ENV=py27 COV_CORE_DEP=cov-core - - env: CWD=pytest-cov TOX_ENV=py32 COV_CORE_DEP=cov-core - - env: CWD=pytest-cov TOX_ENV=py33 COV_CORE_DEP=cov-core - - env: CWD=pytest-cov TOX_ENV=py34 COV_CORE_DEP=cov-core - sudo: false - +env: + global: + LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so + matrix: + - TOXENV=check + - TOXENV=2.6,coveralls + - TOXENV=2.6-nocover + - TOXENV=2.7,coveralls + - TOXENV=2.7-nocover + - TOXENV=3.3,coveralls + - TOXENV=3.3-nocover + - TOXENV=3.4,coveralls + - TOXENV=3.4-nocover + - TOXENV=pypy,coveralls + - TOXENV=pypy-nocover +before_install: + - python --version + - virtualenv --version + - pip --version + - uname -a + - lsb_release -a install: - pip install tox - script: - - cd $CWD && tox -e $TOX_ENV - + - tox -v notifications: email: on_success: never - on_failure: change + on_failure: always + diff --git a/AUTHORS.rst b/AUTHORS.rst new file mode 100644 index 00000000..0e54887e --- /dev/null +++ b/AUTHORS.rst @@ -0,0 +1,5 @@ + +Authors +======= + +* Ionel Cristian Mărieș - http://blog.ionelmc.ro diff --git a/CHANGELOG.rst b/CHANGELOG.rst new file mode 100644 index 00000000..e1310db5 --- /dev/null +++ b/CHANGELOG.rst @@ -0,0 +1,8 @@ + +Changelog +========= + +0.1.0 (2015-06-05) +----------------------------------------- + +* First release on PyPI. diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst new file mode 100644 index 00000000..10586f82 --- /dev/null +++ b/CONTRIBUTING.rst @@ -0,0 +1,89 @@ +============ +Contributing +============ + +Contributions are welcome, and they are greatly appreciated! Every +little bit helps, and credit will always be given. + +Bug reports +=========== + +When `reporting a bug `_ please include: + + * Your operating system name and version. + * Any details about your local setup that might be helpful in troubleshooting. + * Detailed steps to reproduce the bug. + +Documentation improvements +========================== + +pytest-cover could always use more documentation, whether as part of the +official pytest-cover docs, in docstrings, or even on the web in blog posts, +articles, and such. + +Feature requests and feedback +============================= + +The best way to send feedback is to file an issue at https://github.com/ionelmc/pytest-cover/issues. + +If you are proposing a feature: + +* Explain in detail how it would work. +* Keep the scope as narrow as possible, to make it easier to implement. +* Remember that this is a volunteer-driven project, and that contributions are welcome :) + +Development +=========== + +To set up `pytest-cover` for local development: + +1. `Fork pytest-cover on GitHub `_. +2. Clone your fork locally:: + + git clone git@github.com:your_name_here/pytest-cover.git + +3. Create a branch for local development:: + + git checkout -b name-of-your-bugfix-or-feature + + Now you can make your changes locally. + +4. When you're done making changes, run all the checks, doc builder and spell checker with `tox `_ one command:: + + tox + +5. Commit your changes and push your branch to GitHub:: + + git add . + git commit -m "Your detailed description of your changes." + git push origin name-of-your-bugfix-or-feature + +6. Submit a pull request through the GitHub website. + +Pull Request Guidelines +----------------------- + +If you need some code review or feedback while you're developing the code just make the pull request. + +For merging, you should: + +1. Include passing tests (run ``tox``) [1]_. +2. Update documentation when there's new API, functionality etc. +3. Add a note to ``CHANGELOG.rst`` about the changes. +4. Add yourself to ``AUTHORS.rst``. + +.. [1] If you don't have all the necessary python versions available locally you can rely on Travis - it will + `run the tests `_ for each change you add in the pull request. + + It will be slower though ... + +Tips +---- + +To run a subset of tests:: + + tox -e envname -- py.test -k test_myfeature + +To run all the test environments in *parallel* (you need to ``pip install detox``):: + + detox \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..768c5f00 --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015, Ionel Cristian Mărieș +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the +following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following +disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following +disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 00000000..f44be4b5 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,21 @@ +graft docs +graft examples +graft src +graft ci +graft tests + +include *.komodoproject +include .bumpversion.cfg +include .coveragerc +include .isort.cfg +include .pylintrc + +include AUTHORS.rst +include CHANGELOG.rst +include CONTRIBUTING.rst +include LICENSE +include README.rst + +include tox.ini .travis.yml appveyor.yml + +global-exclude *.py[cod] __pycache__ *.so diff --git a/pytest-cov/README.rst b/README.rst similarity index 100% rename from pytest-cov/README.rst rename to README.rst diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 00000000..251e22f8 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,96 @@ +version: '{branch}-{build}' +build: off +environment: + global: + WITH_COMPILER: "cmd /E:ON /V:ON /C .\\ci\\appveyor-with-compiler.cmd" + matrix: + - TOXENV: check + PYTHON_HOME: "C:\\Python27" + PYTHON_VERSION: "2.7" + PYTHON_ARCH: "32" + - TOXENV: "2.7" + TOXPYTHON: "C:\\Python27\\python.exe" + WINDOWS_SDK_VERSION: "v7.0" + PYTHON_HOME: "C:\\Python27" + PYTHON_VERSION: "2.7" + PYTHON_ARCH: "32" + - TOXENV: "2.7" + TOXPYTHON: "C:\\Python27-x64\\python.exe" + WINDOWS_SDK_VERSION: "v7.0" + PYTHON_HOME: "C:\\Python27-x64" + PYTHON_VERSION: "2.7" + PYTHON_ARCH: "64" + - TOXENV: "2.7-nocover" + TOXPYTHON: "C:\\Python27\\python.exe" + WINDOWS_SDK_VERSION: "v7.0" + PYTHON_HOME: "C:\\Python27" + PYTHON_VERSION: "2.7" + PYTHON_ARCH: "32" + - TOXENV: "2.7-nocover" + TOXPYTHON: "C:\\Python27-x64\\python.exe" + WINDOWS_SDK_VERSION: "v7.0" + PYTHON_HOME: "C:\\Python27-x64" + PYTHON_VERSION: "2.7" + PYTHON_ARCH: "64" + - TOXENV: "3.3" + TOXPYTHON: "C:\\Python33\\python.exe" + WINDOWS_SDK_VERSION: "v7.1" + PYTHON_HOME: "C:\\Python33" + PYTHON_VERSION: "3.3" + PYTHON_ARCH: "32" + - TOXENV: "3.3" + TOXPYTHON: "C:\\Python33-x64\\python.exe" + WINDOWS_SDK_VERSION: "v7.1" + PYTHON_HOME: "C:\\Python33-x64" + PYTHON_VERSION: "3.3" + PYTHON_ARCH: "64" + - TOXENV: "3.3-nocover" + TOXPYTHON: "C:\\Python33\\python.exe" + WINDOWS_SDK_VERSION: "v7.1" + PYTHON_HOME: "C:\\Python33" + PYTHON_VERSION: "3.3" + PYTHON_ARCH: "32" + - TOXENV: "3.3-nocover" + TOXPYTHON: "C:\\Python33-x64\\python.exe" + WINDOWS_SDK_VERSION: "v7.1" + PYTHON_HOME: "C:\\Python33-x64" + PYTHON_VERSION: "3.3" + PYTHON_ARCH: "64" + - TOXENV: "3.4" + TOXPYTHON: "C:\\Python34\\python.exe" + WINDOWS_SDK_VERSION: "v7.1" + PYTHON_HOME: "C:\\Python34" + PYTHON_VERSION: "3.4" + PYTHON_ARCH: "32" + - TOXENV: "3.4" + TOXPYTHON: "C:\\Python34-x64\\python.exe" + WINDOWS_SDK_VERSION: "v7.1" + PYTHON_HOME: "C:\\Python34-x64" + PYTHON_VERSION: "3.4" + PYTHON_ARCH: "64" + - TOXENV: "3.4-nocover" + TOXPYTHON: "C:\\Python34\\python.exe" + WINDOWS_SDK_VERSION: "v7.1" + PYTHON_HOME: "C:\\Python34" + PYTHON_VERSION: "3.4" + PYTHON_ARCH: "32" + - TOXENV: "3.4-nocover" + TOXPYTHON: "C:\\Python34-x64\\python.exe" + WINDOWS_SDK_VERSION: "v7.1" + PYTHON_HOME: "C:\\Python34-x64" + PYTHON_VERSION: "3.4" + PYTHON_ARCH: "64" +init: + - "ECHO %TOXENV%" + - ps: "ls C:\\Python*" +install: + - "powershell ci\\appveyor-bootstrap.ps1" +test_script: + - "%PYTHON_HOME%\\Scripts\\tox --version" + - "%PYTHON_HOME%\\Scripts\\virtualenv --version" + - "%PYTHON_HOME%\\Scripts\\pip --version" + - "%WITH_COMPILER% %PYTHON_HOME%\\Scripts\\tox" +after_test: + - "IF \"%TOXENV:~-8,8%\" == \"-nocover\" %WITH_COMPILER% %TOXPYTHON% setup.py bdist_wheel" +artifacts: + - path: dist\* diff --git a/ci/appveyor-bootstrap.ps1 b/ci/appveyor-bootstrap.ps1 new file mode 100644 index 00000000..1dd53420 --- /dev/null +++ b/ci/appveyor-bootstrap.ps1 @@ -0,0 +1,88 @@ +# Source: https://github.com/pypa/python-packaging-user-guide/blob/master/source/code/install.ps1 +# Sample script to install Python and pip under Windows +# Authors: Olivier Grisel and Kyle Kastner +# License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/ + +$BASE_URL = "https://www.python.org/ftp/python/" +$GET_PIP_URL = "https://bootstrap.pypa.io/get-pip.py" +$GET_PIP_PATH = "C:\get-pip.py" + + +function DownloadPython ($python_version, $platform_suffix) { + $webclient = New-Object System.Net.WebClient + $filename = "python-" + $python_version + $platform_suffix + ".msi" + $url = $BASE_URL + $python_version + "/" + $filename + + $basedir = $pwd.Path + "\" + $filepath = $basedir + $filename + if (Test-Path $filename) { + Write-Host "Reusing" $filepath + return $filepath + } + + # Download and retry up to 5 times in case of network transient errors. + Write-Host "Downloading" $filename "from" $url + $retry_attempts = 3 + for($i=0; $i -lt $retry_attempts; $i++){ + try { + $webclient.DownloadFile($url, $filepath) + break + } + Catch [Exception]{ + Start-Sleep 1 + } + } + Write-Host "File saved at" $filepath + return $filepath +} + + +function InstallPython ($python_version, $architecture, $python_home) { + Write-Host "Installing Python" $python_version "for" $architecture "bit architecture to" $python_home + if (Test-Path $python_home) { + Write-Host $python_home "already exists, skipping." + return $false + } + if ($architecture -eq "32") { + $platform_suffix = "" + } else { + $platform_suffix = ".amd64" + } + $filepath = DownloadPython $python_version $platform_suffix + Write-Host "Installing" $filepath "to" $python_home + $args = "/qn /i $filepath TARGETDIR=$python_home" + Write-Host "msiexec.exe" $args + Start-Process -FilePath "msiexec.exe" -ArgumentList $args -Wait -Passthru + Write-Host "Python $python_version ($architecture) installation complete" + return $true +} + + +function InstallPip ($python_home) { + $pip_path = $python_home + "/Scripts/pip.exe" + $python_path = $python_home + "/python.exe" + if (-not(Test-Path $pip_path)) { + Write-Host "Installing pip..." + $webclient = New-Object System.Net.WebClient + $webclient.DownloadFile($GET_PIP_URL, $GET_PIP_PATH) + Write-Host "Executing:" $python_path $GET_PIP_PATH + Start-Process -FilePath "$python_path" -ArgumentList "$GET_PIP_PATH" -Wait -Passthru + } else { + Write-Host "pip already installed." + } +} + +function InstallPackage ($python_home, $pkg) { + $pip_path = $python_home + "/Scripts/pip.exe" + & $pip_path install $pkg +} + +function main () { + InstallPython $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON_HOME + InstallPip $env:PYTHON_HOME + InstallPackage $env:PYTHON_HOME setuptools + InstallPackage $env:PYTHON_HOME wheel + InstallPackage $env:PYTHON_HOME tox +} + +main diff --git a/ci/appveyor-with-compiler.cmd b/ci/appveyor-with-compiler.cmd new file mode 100644 index 00000000..3619733b --- /dev/null +++ b/ci/appveyor-with-compiler.cmd @@ -0,0 +1,37 @@ +:: To build extensions for 64 bit Python 3, we need to configure environment +:: variables to use the MSVC 2010 C++ compilers from GRMSDKX_EN_DVD.iso of: +:: MS Windows SDK for Windows 7 and .NET Framework 4 (SDK v7.1) +:: +:: To build extensions for 64 bit Python 2, we need to configure environment +:: variables to use the MSVC 2008 C++ compilers from GRMSDKX_EN_DVD.iso of: +:: MS Windows SDK for Windows 7 and .NET Framework 3.5 (SDK v7.0) +:: +:: 32 bit builds do not require specific environment configurations. +:: +:: Note: this script needs to be run with the /E:ON and /V:ON flags for the +:: cmd interpreter, at least for (SDK v7.0) +:: +:: More details at: +:: https://github.com/cython/cython/wiki/64BitCythonExtensionsOnWindows +:: http://stackoverflow.com/a/13751649/163740 +:: +:: Author: Olivier Grisel +:: License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/ +@ECHO OFF + +SET COMMAND_TO_RUN=%* +SET WIN_SDK_ROOT=C:\Program Files\Microsoft SDKs\Windows + +IF "%PYTHON_ARCH%"=="64" ( + ECHO SDK: %WINDOWS_SDK_VERSION% ARCH: %PYTHON_ARCH% + SET DISTUTILS_USE_SDK=1 + SET MSSdk=1 + "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Setup\WindowsSdkVer.exe" -q -version:%WINDOWS_SDK_VERSION% + "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Bin\SetEnv.cmd" /x64 /release + ECHO Executing: %COMMAND_TO_RUN% + call %COMMAND_TO_RUN% || EXIT 1 +) ELSE ( + ECHO SDK: %WINDOWS_SDK_VERSION% ARCH: %PYTHON_ARCH% + ECHO Executing: %COMMAND_TO_RUN% + call %COMMAND_TO_RUN% || EXIT 1 +) diff --git a/ci/bootstrap.py b/ci/bootstrap.py new file mode 100755 index 00000000..466bb8fe --- /dev/null +++ b/ci/bootstrap.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +from __future__ import absolute_import, print_function, unicode_literals + +import os +import sys +from os.path import exists +from os.path import join +from os.path import dirname +from os.path import abspath + + +if __name__ == "__main__": + base_path = dirname(dirname(abspath(__file__))) + print("Project path: {0}".format(base_path)) + env_path = join(base_path, ".tox", "bootstrap") + if sys.platform == "win32": + bin_path = join(env_path, "Scripts") + else: + bin_path = join(env_path, "bin") + if not exists(env_path): + import subprocess + print("Making bootstrap env in: {0} ...".format(env_path)) + try: + subprocess.check_call(["virtualenv", env_path]) + except Exception: + subprocess.check_call([sys.executable, "-m", "virtualenv", env_path]) + print("Installing `jinja2` and `matrix` into bootstrap environment ...") + subprocess.check_call([join(bin_path, "pip"), "install", "jinja2", "matrix"]) + activate = join(bin_path, "activate_this.py") + exec(compile(open(activate, "rb").read(), activate, "exec"), dict(__file__=activate)) + + import jinja2 + import matrix + + jinja = jinja2.Environment( + loader=jinja2.FileSystemLoader(join(base_path, "ci", "templates")), + trim_blocks=True, + lstrip_blocks=True, + keep_trailing_newline=True + ) + tox_environments = {} + for (alias, conf) in matrix.from_file(join(base_path, "setup.cfg")).items(): + python = conf["python_versions"] + deps = conf["dependencies"] + if "coverage_flags" in conf: + cover = {"false": False, "true": True}[conf["coverage_flags"].lower()] + if "environment_variables" in conf: + env_vars = conf["environment_variables"] + + tox_environments[alias] = { + "python": "python" + python if "py" not in python else python, + "deps": deps.split(), + } + if "coverage_flags" in conf: + tox_environments[alias].update(cover=cover) + if "environment_variables" in conf: + tox_environments[alias].update(env_vars=env_vars.split()) + + for name in os.listdir(join("ci", "templates")): + with open(join(base_path, name), "w") as fh: + fh.write(jinja.get_template(name).render(tox_environments=tox_environments)) + print("Wrote {}".format(name)) + print("DONE.") diff --git a/ci/templates/.travis.yml b/ci/templates/.travis.yml new file mode 100644 index 00000000..b1d89b30 --- /dev/null +++ b/ci/templates/.travis.yml @@ -0,0 +1,27 @@ +language: python +python: 2.7 +sudo: false +env: + global: + LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so + matrix: + - TOXENV=check +{% for env, config in tox_environments|dictsort %} + - TOXENV={{ env }}{% if config.cover %},coveralls{% endif %} + +{% endfor %} +before_install: + - python --version + - virtualenv --version + - pip --version + - uname -a + - lsb_release -a +install: + - pip install tox +script: + - tox -v +notifications: + email: + on_success: never + on_failure: always + diff --git a/ci/templates/appveyor.yml b/ci/templates/appveyor.yml new file mode 100644 index 00000000..55310322 --- /dev/null +++ b/ci/templates/appveyor.yml @@ -0,0 +1,39 @@ +version: '{branch}-{build}' +build: off +environment: + global: + WITH_COMPILER: "cmd /E:ON /V:ON /C .\\ci\\appveyor-with-compiler.cmd" + matrix: + - TOXENV: check + PYTHON_HOME: "C:\\Python27" + PYTHON_VERSION: "2.7" + PYTHON_ARCH: "32" +{% for env, config in tox_environments|dictsort %}{% if env.startswith('2.7') or env.startswith('3.4') or env.startswith('3.3') %} + - TOXENV: "{{ env }}" + TOXPYTHON: "C:\\Python{{ env[:3].replace('.', '') }}\\python.exe" + WINDOWS_SDK_VERSION: "v7.{{ '1' if env[0] == '3' else '0' }}" + PYTHON_HOME: "C:\\Python{{ env[:3].replace('.', '') }}" + PYTHON_VERSION: "{{ env[:3] }}" + PYTHON_ARCH: "32" + - TOXENV: "{{ env }}" + TOXPYTHON: "C:\\Python{{ env[:3].replace('.', '') }}-x64\\python.exe" + WINDOWS_SDK_VERSION: "v7.{{ '1' if env[0] == '3' else '0' }}" + PYTHON_HOME: "C:\\Python{{ env[:3].replace('.', '') }}-x64" + PYTHON_VERSION: "{{ env[:3] }}" + PYTHON_ARCH: "64" +{% endif %}{% endfor %} +init: + - "ECHO %TOXENV%" + - ps: "ls C:\\Python*" +install: + - "powershell ci\\appveyor-bootstrap.ps1" +test_script: + - "%PYTHON_HOME%\\Scripts\\tox --version" + - "%PYTHON_HOME%\\Scripts\\virtualenv --version" + - "%PYTHON_HOME%\\Scripts\\pip --version" + - "%WITH_COMPILER% %PYTHON_HOME%\\Scripts\\tox" +after_test: + - "IF \"%TOXENV:~-8,8%\" == \"-nocover\" %WITH_COMPILER% %TOXPYTHON% setup.py bdist_wheel" +artifacts: + - path: dist\* + diff --git a/ci/templates/tox.ini b/ci/templates/tox.ini new file mode 100644 index 00000000..c96fb687 --- /dev/null +++ b/ci/templates/tox.ini @@ -0,0 +1,117 @@ +[tox] +envlist = + clean, + check, +{% for env in tox_environments|sort %} + {{ env }}, +{% endfor %} + report, + docs + +[testenv] +setenv = + PYTHONPATH={toxinidir}/tests + PYTHONUNBUFFERED=yes +passenv = + * +deps = + pytest + pytest-capturelog +commands = + {posargs:py.test -vv --ignore=src} + +[testenv:spell] +setenv = + SPELLCHECK = 1 +commands = + sphinx-build -b spelling docs dist/docs +usedevelop = true +deps = + -r{toxinidir}/docs/requirements.txt + sphinxcontrib-spelling + pyenchant + +[testenv:docs] +whitelist_externals = + rm +commands = + sphinx-build {posargs:-E} -b html docs dist/docs + sphinx-build -b linkcheck docs dist/docs +usedevelop = true +deps = + -r{toxinidir}/docs/requirements.txt + +[testenv:configure] +deps = + jinja2 + matrix +usedevelop = true +commands = + python bootstrap.py + +[testenv:check] +basepython = python3.4 +deps = + docutils + check-manifest + flake8 + readme + pygments +usedevelop = true +commands = + python setup.py check --strict --metadata --restructuredtext + check-manifest {toxinidir} + flake8 src + +[testenv:coveralls] +deps = + coveralls +usedevelop = true +commands = + coverage combine + coverage report + coveralls + +[testenv:report] +basepython = python3.4 +commands = + coverage combine + coverage report +usedevelop = true +deps = coverage + +[testenv:clean] +commands = coverage erase +usedevelop = true +deps = coverage + +{% for env, config in tox_environments|dictsort %} +[testenv:{{ env }}] +basepython = {{ config.python }} +{% if config.cover or config.env_vars %} +setenv = + {[testenv]setenv} +{% endif %} +{% for var in config.env_vars %} + {{ var }} +{% endfor %} +{% if config.cover %} + WITH_COVERAGE=yes +usedevelop = true +commands = + {posargs:py.test --cov=src --cov-report=term-missing -vv} +{% endif %} +{% if config.cover or config.deps %} +deps = + {[testenv]deps} +{% endif %} +{% if config.cover %} + pytest-cov +{% endif %} +{% for dep in config.deps %} + {{ dep }} +{% endfor %} + +{% endfor %} + + diff --git a/docs/authors.rst b/docs/authors.rst new file mode 100644 index 00000000..e122f914 --- /dev/null +++ b/docs/authors.rst @@ -0,0 +1 @@ +.. include:: ../AUTHORS.rst diff --git a/docs/changelog.rst b/docs/changelog.rst new file mode 100644 index 00000000..565b0521 --- /dev/null +++ b/docs/changelog.rst @@ -0,0 +1 @@ +.. include:: ../CHANGELOG.rst diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 00000000..42fc5872 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +import os + + +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.autosummary', + 'sphinx.ext.todo', + 'sphinx.ext.coverage', + 'sphinx.ext.ifconfig', + 'sphinx.ext.viewcode', + 'sphinxcontrib.napoleon' +] +if os.getenv('SPELLCHECK'): + extensions += 'sphinxcontrib.spelling', + spelling_show_suggestions = True + spelling_lang = 'en_US' + +source_suffix = '.rst' +master_doc = 'index' +project = u'pytest-cover' +year = u'2015' +author = u'Ionel Cristian M\u0103rie\u0219' +copyright = '{0}, {1}'.format(year, author) +version = release = u'0.1.0' + +import sphinx_py3doc_enhanced_theme +html_theme = "sphinx_py3doc_enhanced_theme" +html_theme_path = [sphinx_py3doc_enhanced_theme.get_html_theme_path()] + +pygments_style = 'trac' +templates_path = ['.'] +html_use_smartypants = True +html_last_updated_fmt = '%b %d, %Y' +html_split_index = True +html_sidebars = { + '**': ['searchbox.html', 'globaltoc.html', 'sourcelink.html'], +} +html_short_title = '%s-%s' % (project, version) +html_theme_options = { + 'githuburl': 'https://github.com/ionelmc/pytest-cover/' +} diff --git a/docs/contributing.rst b/docs/contributing.rst new file mode 100644 index 00000000..e582053e --- /dev/null +++ b/docs/contributing.rst @@ -0,0 +1 @@ +.. include:: ../CONTRIBUTING.rst diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 00000000..be946912 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,23 @@ +Welcome to pytest-cover's documentation! +====================================== + +Contents: + +.. toctree:: + :maxdepth: 2 + + readme + installation + usage + reference/index + contributing + authors + changelog + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + diff --git a/docs/installation.rst b/docs/installation.rst new file mode 100644 index 00000000..76e143b2 --- /dev/null +++ b/docs/installation.rst @@ -0,0 +1,7 @@ +============ +Installation +============ + +At the command line:: + + pip install pytest-cover diff --git a/docs/readme.rst b/docs/readme.rst new file mode 100644 index 00000000..6be290b8 --- /dev/null +++ b/docs/readme.rst @@ -0,0 +1,5 @@ +######## +Overview +######## + +.. include:: ../README.rst diff --git a/docs/reference/index.rst b/docs/reference/index.rst new file mode 100644 index 00000000..8cb90cb5 --- /dev/null +++ b/docs/reference/index.rst @@ -0,0 +1,7 @@ +Reference +========= + +.. toctree:: + :glob: + + pytest_cover* diff --git a/docs/reference/pytest_cover.rst b/docs/reference/pytest_cover.rst new file mode 100644 index 00000000..a3695344 --- /dev/null +++ b/docs/reference/pytest_cover.rst @@ -0,0 +1,5 @@ +pytest_cover +============================= + +.. automodule:: pytest_cover + :members: diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 00000000..1632a968 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,4 @@ +sphinx +sphinxcontrib-napoleon +sphinx-py3doc-enhanced-theme +-e . diff --git a/docs/spelling_wordlist.txt b/docs/spelling_wordlist.txt new file mode 100644 index 00000000..f95eb78d --- /dev/null +++ b/docs/spelling_wordlist.txt @@ -0,0 +1,11 @@ +builtin +builtins +classmethod +staticmethod +classmethods +staticmethods +args +kwargs +callstack +Changelog +Indices diff --git a/docs/usage.rst b/docs/usage.rst new file mode 100644 index 00000000..36872c2d --- /dev/null +++ b/docs/usage.rst @@ -0,0 +1,7 @@ +===== +Usage +===== + +To use pytest-cover in a project:: + + import pytest_cover diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..1b2705ee --- /dev/null +++ b/setup.cfg @@ -0,0 +1,86 @@ +[bdist_wheel] +universal = 1 + +[aliases] +release = register clean --all sdist bdist_wheel + +[flake8] +max-line-length = 140 +exclude = tests/*,*/migrations/*,*/south_migrations/* + +[bumpversion] +current_version = 0.1.0 +files = setup.py docs/conf.py src/pytest_cover/__init__.py +commit = True +tag = True + +[pytest] +norecursedirs = + .git + .tox + dist + build + south_migrations + migrations +python_files = + test_*.py + *_test.py + tests.py +addopts = + -rxEfs + --strict + --ignore=docs/conf.py + --ignore=setup.py + --ignore=ci + --doctest-modules + --doctest-glob=\*.rst + --tb=short + +[isort] +force_single_line=True +line_length=120 +known_first_party=pytest_cover +default_section=THIRDPARTY +forced_separate=test_pytest_cover + +[matrix] +# This is the configuration for the `./bootstrap.py` script. +# It generates `.travis.yml`, `tox.ini` and `appveyor.yml`. +# +# Syntax: [alias:] value [!variable[glob]] [&variable[glob]] +# +# alias: +# - is used to generate the tox environment +# - it's optional +# - if not present the alias will be computed from the `value` +# value: +# - a value of "-" means empty +# !variable[glob]: +# - exclude the combination of the current `value` with +# any value matching the `glob` in `variable` +# - can use as many you want +# &variable[glob]: +# - only include the combination of the current `value` +# when there's a value matching `glob` in `variable` +# - can use as many you want + +python_versions = + 2.6 + 2.7 + 3.3 + 3.4 + pypy + +dependencies = +# 1.4: Django==1.4.16 !python_versions[3.*] +# 1.5: Django==1.5.11 +# 1.6: Django==1.6.8 +# 1.7: Django==1.7.1 !python_versions[2.6] +# Deps commented above are provided as examples. That's what you would use in a Django project. + +coverage_flags = + : true + nocover: false + +environment_variables = + - diff --git a/cov-core/setup.py b/setup.py similarity index 100% rename from cov-core/setup.py rename to setup.py diff --git a/tox.ini b/tox.ini index b59374ac..9896ed03 100644 --- a/tox.ini +++ b/tox.ini @@ -1,9 +1,113 @@ +; a generative tox configuration, see: https://testrun.org/tox/latest/config.html#generative-envlist + [tox] -envlist = flake8 +envlist = + clean, + check, + {2.6,2.7,3.3,3.4,pypy}, + {2.6,2.7,3.3,3.4,pypy}-nocover, + report, + docs + +[testenv] +basepython = + pypy: pypy + 2.6: python2.6 + {2.7,docs}: python2.7 + 3.3: python3.3 + 3.4: python3.4 + {clean,check,report,extension-coveralls,coveralls}: python3.4 +setenv = + PYTHONPATH={toxinidir}/tests + PYTHONUNBUFFERED=yes +passenv = + * +deps = + pytest + pytest-capturelog + pytest-cov +commands = + {posargs:py.test --cov=src --cov-report=term-missing -vv} +usedevelop = true + +[testenv:spell] +setenv = + SPELLCHECK=1 +commands = + sphinx-build -b spelling docs dist/docs +usedevelop = true +deps = + -r{toxinidir}/docs/requirements.txt + sphinxcontrib-spelling + pyenchant + +[testenv:docs] +whitelist_externals = + rm +commands = + sphinx-build {posargs:-E} -b html docs dist/docs + sphinx-build -b linkcheck docs dist/docs +usedevelop = true +deps = + -r{toxinidir}/docs/requirements.txt + +[testenv:check] +basepython = python3.4 +deps = + docutils + check-manifest + flake8 + readme + pygments +usedevelop = true +commands = + python setup.py check --strict --metadata --restructuredtext + check-manifest {toxinidir} + flake8 src + +[testenv:coveralls] +deps = + coveralls +usedevelop = true +commands = + coverage combine + coverage report + coveralls +[testenv:report] +basepython = python3.4 +commands = + coverage combine + coverage report +usedevelop = true +deps = coverage + +[testenv:clean] +commands = coverage erase +usedevelop = true +deps = coverage + +[testenv:2.6-nocover] +commands = + {posargs:py.test -vv --ignore=src} +usedevelop = false + +[testenv:2.7-nocover] +commands = + {posargs:py.test -vv --ignore=src} +usedevelop = false + +[testenv:3.3-nocover] +commands = + {posargs:py.test -vv --ignore=src} +usedevelop = false + +[testenv:3.4-nocover] +commands = + {posargs:py.test -vv --ignore=src} +usedevelop = false -[flake8] -max-line-length = 99 +[testenv:pypy-nocover] +commands = + {posargs:py.test -vv --ignore=src} +usedevelop = false -[testenv:flake8] -deps = flake8 -commands = flake8 From f1e0bd3d7ded284d2bb662dd68542b8acd72d0dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Fri, 5 Jun 2015 21:29:43 +0300 Subject: [PATCH 05/47] More corrections. --- LICENSE | 25 ++++++------- README.rst | 102 +++++++++++++++++++++++++++++++---------------------- 2 files changed, 69 insertions(+), 58 deletions(-) diff --git a/LICENSE b/LICENSE index 768c5f00..e98b6474 100644 --- a/LICENSE +++ b/LICENSE @@ -1,19 +1,14 @@ Copyright (c) 2015, Ionel Cristian Mărieș -All rights reserved. -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the -following conditions are met: +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: -1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following -disclaimer. +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the +Software. -2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following -disclaimer in the documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +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. \ No newline at end of file diff --git a/README.rst b/README.rst index 9100bb8f..68e51c14 100644 --- a/README.rst +++ b/README.rst @@ -1,26 +1,62 @@ -pytest-cov -========== +=============================== +pytest-cover +=============================== -.. image:: https://travis-ci.org/schlamar/pytest-cov.svg?branch=master - :target: https://travis-ci.org/schlamar/pytest-cov - :alt: Build status - -.. image:: https://pypip.in/download/pytest-cov/badge.png - :target: https://pypi.python.org/pypi//pytest-cov/ - :alt: Downloads +| |docs| |travis| |appveyor| |coveralls| +| |version| |downloads| |wheel| |supported-versions| |supported-implementations| -.. image:: https://pypip.in/version/pytest-cov/badge.png - :target: https://pypi.python.org/pypi/pytest-cov/ - :alt: Latest Version +.. |docs| image:: https://readthedocs.org/projects/pytest-coverer/badge/?style=flat + :target: https://readthedocs.org/projects/pytest-coverer + :alt: Documentation Status -.. image:: https://pypip.in/license/pytest-cov/badge.png - :target: https://pypi.python.org/pypi/pytest-cov/ - :alt: License +.. |travis| image:: http://img.shields.io/travis/ionelmc/pytest-coverer/master.png?style=flat + :alt: Travis-CI Build Status + :target: https://travis-ci.org/ionelmc/pytest-coverer + +.. |appveyor| image:: https://ci.appveyor.com/api/projects/status/github/ionelmc/pytest-coverer?branch=master + :alt: AppVeyor Build Status + :target: https://ci.appveyor.com/project/ionelmc/pytest-coverer + +.. |coveralls| image:: http://img.shields.io/coveralls/ionelmc/pytest-coverer/master.png?style=flat + :alt: Coverage Status + :target: https://coveralls.io/r/ionelmc/pytest-coverer + +.. |landscape| image:: https://landscape.io/github/ionelmc/pytest-coverer/master/landscape.svg?style=flat + :target: https://landscape.io/github/ionelmc/pytest-coverer/master + :alt: Code Quality Status + +.. |version| image:: http://img.shields.io/pypi/v/pytest-coverer.png?style=flat + :alt: PyPI Package latest release + :target: https://pypi.python.org/pypi/pytest-coverer + +.. |downloads| image:: http://img.shields.io/pypi/dm/pytest-coverer.png?style=flat + :alt: PyPI Package monthly downloads + :target: https://pypi.python.org/pypi/pytest-coverer + +.. |wheel| image:: https://pypip.in/wheel/pytest-coverer/badge.png?style=flat + :alt: PyPI Wheel + :target: https://pypi.python.org/pypi/pytest-coverer + +.. |supported-versions| image:: https://pypip.in/py_versions/pytest-coverer/badge.png?style=flat + :alt: Supported versions + :target: https://pypi.python.org/pypi/pytest-coverer + +.. |supported-implementations| image:: https://pypip.in/implementation/pytest-coverer/badge.png?style=flat + :alt: Supported imlementations + :target: https://pypi.python.org/pypi/pytest-coverer + +.. |scrutinizer| image:: https://img.shields.io/scrutinizer/g/ionelmc/pytest-coverer/master.png?style=flat + :alt: Scrutinizer Status + :target: https://scrutinizer-ci.com/g/ionelmc/pytest-coverer/ + +Pytest plugin for measuring coverage. Forked from `pytest-cov `_. + +* Free software: MIT license This plugin produces coverage reports. It supports centralised testing and distributed testing in both load and each modes. It also supports coverage of subprocesses. -All features offered by the coverage package should be available, either through pytest-cov or +All features offered by the coverage package should be available, either through pytest-cover or through coverage's config file. @@ -29,7 +65,7 @@ Installation Install with pip:: - pip install pytest-cov + pip install pytest-cover For distributed testing support install pytest-xdist:: @@ -46,16 +82,7 @@ Uninstallation Uninstall with pip:: - pip uninstall pytest-cov - pip uninstall cov-core - -.. NOTE:: - - Ensure that you manually delete the init_cov_core.pth file in your site-packages directory. - - This file starts coverage collection of subprocesses if appropriate during site initialisation - at python startup. - + pip uninstall pytest-cover Usage ----- @@ -244,12 +271,12 @@ effect. These include specifying source to be measured (source option) and all Limitations ----------- -For distributed testing the slaves must have the pytest-cov package installed. This is needed since -the plugin must be registered through setuptools / distribute for pytest to start the plugin on the +For distributed testing the slaves must have the pytest-cover package installed. This is needed since +the plugin must be registered through setuptools for pytest to start the plugin on the slave. For subprocess measurement environment variables must make it from the main process to the -subprocess. The python used by the subprocess must have pytest-cov installed. The subprocess must +subprocess. The python used by the subprocess must have pytest-cover installed. The subprocess must do normal site initialisation so that the environment variables can be detected and coverage started. @@ -257,16 +284,5 @@ started. Acknowledgements ---------------- -Whilst this plugin has been built fresh from the ground up it has been influenced by the work done -on pytest-coverage (Ross Lawley, James Mills, Holger Krekel) and nose-cover (Jason Pellerin) which are -other coverage plugins. - -Ned Batchelder for coverage and its ability to combine the coverage results of parallel runs. - -Holger Krekel for pytest with its distributed testing support. - -Jason Pellerin for nose. - -Michael Foord for unittest2. - -No doubt others have contributed to these tools as well. +`Marc Schlaich` for creating `pytest-cov (and cov-core) `_. +This plugin is a merge of those two packages with other fixes. \ No newline at end of file From c9731ab59edd7325732dc597484e6929845417b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Fri, 5 Jun 2015 21:52:32 +0300 Subject: [PATCH 06/47] Update setup.py to have the new pth handling and layout support. --- setup.py | 202 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 128 insertions(+), 74 deletions(-) diff --git a/setup.py b/setup.py index bd6853f0..f37d3b84 100644 --- a/setup.py +++ b/setup.py @@ -1,77 +1,131 @@ -import setuptools -import sys +#!/usr/bin/env python +# -*- encoding: utf-8 -*- +from __future__ import absolute_import, print_function + +import io import os +import re +from glob import glob +from os.path import basename +from os.path import dirname +from os.path import join +from os.path import relpath +from os.path import splitext + +from setuptools import find_packages +from setuptools import setup + +def read(*names, **kwargs): + return io.open( + join(dirname(__file__), *names), + encoding=kwargs.get('encoding', 'utf8') + ).read() + + +class BuildWithPTH(build): + def run(self): + build.run(self) + path = join(dirname(__file__), 'src', 'pytest-cover.pth') + dest = join(self.build_lib, basename(path)) + self.copy_file(path, dest) + + +class EasyInstallWithPTH(easy_install): + def run(self): + easy_install.run(self) + path = join(dirname(__file__), 'src', 'pytest-cover.pth') + dest = join(self.install_dir, basename(path)) + self.copy_file(path, dest) + + +class InstallLibWithPTH(install_lib): + def run(self): + install_lib.run(self) + path = join(dirname(__file__), 'src', 'pytest-cover.pth') + dest = join(self.install_dir, basename(path)) + self.copy_file(path, dest) + self.outputs = [dest] -# The name of the path file must appear after easy-install.pth so that -# cov_core has been added to the sys.path and cov_core_init can be -# imported. -PTH_FILE_NAME = 'init_cov_core.pth' - -# The line in the path file must begin with "import" -# so that site.py will exec it. -PTH_FILE = '''\ -import os; exec(%r) -''' % ''' -if 'COV_CORE_SOURCE' in os.environ: - try: - import cov_core_init - cov_core_init.init() - except ImportError: + def get_outputs(self): + return chain(install_lib.get_outputs(self), self.outputs) + + +class DevelopWithPTH(develop): + def run(self): + develop.run(self) + path = join(dirname(__file__), 'src', 'pytest-cover.pth') + dest = join(self.install_dir, basename(path)) + self.copy_file(path, dest) + + +class GeneratePTH(Command): + user_options = [] + + def initialize_options(self): pass -''' - -PTH_FILE_FAILURE = ''' -Subprocesses WILL NOT have coverage collected. - -To measure subprocesses put the following in a pth file called %s: -%s -''' % (PTH_FILE_NAME, PTH_FILE) - -setuptools.setup(name='cov-core', - version='1.15.0', - description='plugin core for use by pytest-cov, ' - 'nose-cov and nose2-cov', - long_description=open('README.rst').read().strip(), - author='Marc Schlaich', - author_email='marc.schlaich@gmail.com', - url='https://github.com/schlamar/cov-core', - py_modules=['cov_core', - 'cov_core_init'], - install_requires=['coverage>=3.6'], - license='MIT License', - zip_safe=False, - keywords='cover coverage', - classifiers=['Development Status :: 4 - Beta', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Python :: 2.4', - 'Programming Language :: Python :: 2.5', - 'Programming Language :: Python :: 2.6', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3.0', - 'Programming Language :: Python :: 3.1', - 'Topic :: Software Development :: Testing']) - -if sys.argv[1] in ('install', 'develop'): - for path in sys.path: - if (path.endswith('site-packages')) or (path.endswith('dist-packages') - and 'local' in path): - path = os.path.join(path, PTH_FILE_NAME) - try: - pth_file = open(path, 'w') - pth_file.write(PTH_FILE) - pth_file.close() - sys.stdout.write('\nWrote pth file for subprocess ' - 'measurement to %s\n' % path) - break - except Exception: - sys.stdout.write('\nFailed to write pth file for subprocess ' - 'measurement to %s\n' % path) - sys.stdout.write(PTH_FILE_FAILURE) - break - else: - sys.stdout.write('\nFailed to find site-packages or dist-packages ' - 'dir to put pth file in.\n') - sys.stdout.write(PTH_FILE_FAILURE) + + def finalize_options(self): + pass + + def run(self): + with open(join(dirname(__file__), 'src', 'pytest-cover.pth'), 'w') as fh: + with open(join(dirname(__file__), 'src', 'pytest-cover.embed')) as sh: + fh.write( + 'import os, sys;' + 'exec(%r)' % sh.read().replace(' ', ' ') + ) + +setup( + name='pytest-cover', + version='0.1.0', + license='MIT', + description='Pytest plugin for measuring coverage. Forked from `pytest-cov`.', + long_description='%s\n%s' % (read('README.rst'), re.sub(':[a-z]+:`~?(.*?)`', r'``\1``', read('CHANGELOG.rst'))), + author='Marc Schlaich', + author_email='marc.schlaich@gmail.com', + maintainer='Ionel Cristian M\u0103rie\u0219', + maintainer_email='contact@ionelmc.ro', + url='https://github.com/ionelmc/pytest-cover', + packages=find_packages('src'), + package_dir={'': 'src'}, + py_modules=[splitext(basename(path))[0] for path in glob('src/*.py')], + include_package_data=True, + zip_safe=False, + classifiers=[ + # complete classifier list: http://pypi.python.org/pypi?%3Aaction=list_classifiers + 'Development Status :: 5 - Production/Stable', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: BSD License', + 'Operating System :: Unix', + 'Operating System :: POSIX', + 'Operating System :: Microsoft :: Windows', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2.6', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: Implementation :: CPython', + 'Programming Language :: Python :: Implementation :: PyPy', + 'Topic :: Utilities', + 'Topic :: Software Development :: Testing' + ], + keywords=[ + 'cover', 'coverage', 'pytest', 'py.test', 'distributed', 'parallel', + ], + install_requires=[ + ], + extras_require={ + }, + entry_points={ + 'console_scripts': [ + ] + }, + cmdclass={ + 'build': BuildWithPTH, + 'easy_install': EasyInstallWithPTH, + 'install_lib': InstallLibWithPTH, + 'develop': DevelopWithPTH, + 'genpth': GeneratePTH, + }, +) From a6c5fa6c8c2b245602f83cbe8a180c9a1ea40b42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sat, 6 Jun 2015 00:43:05 +0300 Subject: [PATCH 07/47] Remove --cov-source and fix --cov without arg to activate coverage (with no sources specified). --- src/pytest_cover/plugin.py | 16 +++------ tests/test_pytest_cover.py | 67 +++++++++++++++----------------------- 2 files changed, 31 insertions(+), 52 deletions(-) diff --git a/src/pytest_cover/plugin.py b/src/pytest_cover/plugin.py index 0ac9dd81..289a8223 100644 --- a/src/pytest_cover/plugin.py +++ b/src/pytest_cover/plugin.py @@ -17,12 +17,8 @@ def pytest_addoption(parser): group = parser.getgroup( 'cov', 'coverage reporting with distributed testing support') - - group.addoption('--cov', action='append', nargs='?', dest='cov', - const=True, default=[], - help='Enable coverage plugin.') - group.addoption('--cov-source', action='append', default=[], - metavar='path', dest='cov_source', + group.addoption('--cov', action='append', default=[], metavar='path', + nargs='?', const=True, dest='cov_source', help='measure coverage for filesystem path ' '(multi-allowed)') group.addoption('--cov-report', action='append', default=[], @@ -45,13 +41,9 @@ def pytest_addoption(parser): @pytest.mark.tryfirst def pytest_load_initial_conftests(early_config, parser, args): ns = parser.parse_known_args(args) - if ns.cov and ns.cov != [True]: - print ('Deprecation warning: --cov shouldn\'t be used ' - 'with additional source arguments anymore. Use ' - '--cov-source instead.') - ns.cov_source.extend(ns.cov) + ns.cov = bool(ns.cov_source) - if not ns.cov_source: + if ns.cov_source == [True]: ns.cov_source = None if not ns.cov_report: diff --git a/tests/test_pytest_cover.py b/tests/test_pytest_cover.py index b2a3ee3d..e7ad85f7 100644 --- a/tests/test_pytest_cover.py +++ b/tests/test_pytest_cover.py @@ -1,4 +1,3 @@ - import os import sys @@ -6,7 +5,8 @@ import py import pytest -import pytest_cov +import subprocess +import pytest_cover.plugin pytest_plugins = 'pytester', 'cov' @@ -101,7 +101,7 @@ def test_central(testdir): script = testdir.makepyfile(SCRIPT) result = testdir.runpytest('-v', - '--cov', '--cov-source=%s' % script.dirpath(), + '--cov=%s' % script.dirpath(), '--cov-report=term-missing', script) @@ -117,7 +117,7 @@ def test_cov_min_100(testdir): script = testdir.makepyfile(SCRIPT) result = testdir.runpytest('-v', - '--cov', '--cov-source=%s' % script.dirpath(), + '--cov=%s' % script.dirpath(), '--cov-report=term-missing', '--cov-min=100', script) @@ -129,7 +129,7 @@ def test_cov_min_50(testdir): script = testdir.makepyfile(SCRIPT) result = testdir.runpytest('-v', - '--cov', '--cov-source=%s' % script.dirpath(), + '--cov=%s' % script.dirpath(), '--cov-report=term-missing', '--cov-min=50', script) @@ -141,7 +141,7 @@ def test_cov_min_no_report(testdir): script = testdir.makepyfile(SCRIPT) result = testdir.runpytest('-v', - '--cov', '--cov-source=%s' % script.dirpath(), + '--cov=%s' % script.dirpath(), '--cov-report=', '--cov-min=50', script) @@ -194,7 +194,7 @@ def test_no_cov_on_fail(testdir): script = testdir.makepyfile(SCRIPT_FAIL) result = testdir.runpytest('-v', - '--cov', '--cov-source=%s' % script.dirpath(), + '--cov=%s' % script.dirpath(), '--cov-report=term-missing', '--no-cov-on-fail', script) @@ -207,7 +207,7 @@ def test_dist_collocated(testdir): script = testdir.makepyfile(SCRIPT) result = testdir.runpytest('-v', - '--cov', '--cov-source=%s' % script.dirpath(), + '--cov=%s' % script.dirpath(), '--cov-report=term-missing', '--dist=load', '--tx=2*popen', @@ -227,7 +227,7 @@ def test_dist_not_collocated(testdir): dir2 = testdir.mkdir('dir2') result = testdir.runpytest('-v', - '--cov', '--cov-source=%s' % script.dirpath(), + '--cov=%s' % script.dirpath(), '--cov-report=term-missing', '--dist=load', '--tx=popen//chdir=%s' % dir1, @@ -249,7 +249,7 @@ def test_central_subprocess(testdir): parent_script = scripts.dirpath().join('parent_script.py') result = testdir.runpytest('-v', - '--cov', '--cov-source=%s' % scripts.dirpath(), + '--cov=%s' % scripts.dirpath(), '--cov-report=term-missing', parent_script) @@ -267,7 +267,7 @@ def test_dist_subprocess_collocated(testdir): parent_script = scripts.dirpath().join('parent_script.py') result = testdir.runpytest('-v', - '--cov', '--cov-source=%s' % scripts.dirpath(), + '--cov=%s' % scripts.dirpath(), '--cov-report=term-missing', '--dist=load', '--tx=2*popen', @@ -291,7 +291,7 @@ def test_dist_subprocess_not_collocated(testdir, tmpdir): dir2 = tmpdir.mkdir('dir2') result = testdir.runpytest('-v', - '--cov', '--cov-source=%s' % scripts.dirpath(), + '--cov=%s' % scripts.dirpath(), '--cov-report=term-missing', '--dist=load', '--tx=popen//chdir=%s' % dir1, @@ -312,7 +312,7 @@ def test_empty_report(testdir): script = testdir.makepyfile(SCRIPT) result = testdir.runpytest('-v', - '--cov', '--cov-source=non_existent_module', + '--cov=non_existent_module', '--cov-report=term-missing', script) @@ -332,10 +332,11 @@ def test_dist_missing_data(testdir): exe = os.path.join(venv_path, 'Scripts', 'python.exe') else: exe = os.path.join(venv_path, 'bin', 'python') + subprocess.check_call([exe, '-mpip', 'install', 'py', 'pytest']) script = testdir.makepyfile(SCRIPT) result = testdir.runpytest('-v', - '--cov', '--cov-source=%s' % script.dirpath(), + '--cov=%s' % script.dirpath(), '--cov-report=term-missing', '--dist=load', '--tx=popen//python=%s' % exe, @@ -351,7 +352,7 @@ def test_funcarg(testdir): script = testdir.makepyfile(SCRIPT_FUNCARG) result = testdir.runpytest('-v', - '--cov', '--cov-source=%s' % script.dirpath(), + '--cov=%s' % script.dirpath(), '--cov-report=term-missing', script) @@ -381,7 +382,7 @@ def test_multiprocessing_subprocess(testdir): script = testdir.makepyfile(MULTIPROCESSING_SCRIPT) result = testdir.runpytest('-v', - '--cov', '--cov-source=%s' % script.dirpath(), + '--cov=%s' % script.dirpath(), '--cov-report=term-missing', script) @@ -422,7 +423,7 @@ def test_cover_conftest(testdir): testdir.makeconftest(CONFTEST) script = testdir.makepyfile(BASIC_TEST) result = testdir.runpytest('-v', - '--cov', '--cov-source=%s' % script.dirpath(), + '--cov=%s' % script.dirpath(), '--cov-report=term-missing', script) assert result.ret == 0 @@ -434,7 +435,7 @@ def test_cover_conftest_dist(testdir): testdir.makeconftest(CONFTEST) script = testdir.makepyfile(BASIC_TEST) result = testdir.runpytest('-v', - '--cov', '--cov-source=%s' % script.dirpath(), + '--cov=%s' % script.dirpath(), '--cov-report=term-missing', '--dist=load', '--tx=2*popen', @@ -470,7 +471,7 @@ def test_coveragerc(testdir): script = testdir.makepyfile(EXCLUDED_TEST) result = testdir.runpytest('-v', '--cov-config=coveragerc', - '--cov', '--cov-source=%s' % script.dirpath(), + '--cov=%s' % script.dirpath(), '--cov-report=term-missing', script) assert result.ret == 0 @@ -482,7 +483,7 @@ def test_coveragerc_dist(testdir): script = testdir.makepyfile(EXCLUDED_TEST) result = testdir.runpytest('-v', '--cov-config=coveragerc', - '--cov', '--cov-source=%s' % script.dirpath(), + '--cov=%s' % script.dirpath(), '--cov-report=term-missing', '-n', '2', script) @@ -504,7 +505,7 @@ def test_basic(): def test_clear_environ(testdir): script = testdir.makepyfile(CLEAR_ENVIRON_TEST) result = testdir.runpytest('-v', - '--cov', '--cov-source=%s' % script.dirpath(), + '--cov=%s' % script.dirpath(), '--cov-report=term-missing', script) assert result.ret == 0 @@ -527,7 +528,7 @@ def test_dist_boxed(testdir): script = testdir.makepyfile(SCRIPT_SIMPLE) result = testdir.runpytest('-v', - '--cov', '--cov-source=%s' % script.dirpath(), + '--cov=%s' % script.dirpath(), '--boxed', script) @@ -540,29 +541,16 @@ def test_dist_boxed(testdir): def test_not_started_plugin_does_not_fail(testdir): - plugin = pytest_cov.CovPlugin(None, None, start=False) + plugin = pytest_cover.plugin.CovPlugin(None, None, start=False) plugin.pytest_sessionfinish(None, None) plugin.pytest_terminal_summary(None) -def test_deprecation_warning(testdir): - script = testdir.makepyfile(SCRIPT) - - result = testdir.runpytest('-v', - '--cov=%s' % script.dirpath(), - script) - - result.stdout.fnmatch_lines([ - 'Deprecation warning: * --cov-source instead*' - ]) - assert result.ret == 0 - - def test_default_output_setting(testdir): script = testdir.makepyfile(SCRIPT) result = testdir.runpytest('-v', - '--cov', '--cov-source=%s' % script.dirpath(), + '--cov=%s' % script.dirpath(), script) result.stdout.fnmatch_lines([ @@ -575,7 +563,7 @@ def test_disabled_output(testdir): script = testdir.makepyfile(SCRIPT) result = testdir.runpytest('-v', - '--cov', '--cov-source=%s' % script.dirpath(), + '--cov=%s' % script.dirpath(), '--cov-report=', script) @@ -588,8 +576,7 @@ def test_coverage_file(testdir): data_file_name = 'covdata' os.environ['COVERAGE_FILE'] = data_file_name try: - result = testdir.runpytest('-v', '--cov', - '--cov-source=%s' % script.dirpath(), + result = testdir.runpytest('-v', '--cov=%s' % script.dirpath(), script) assert result.ret == 0 data_file = testdir.tmpdir.join(data_file_name) From ca12e6b970fe7d9ab12e51f1f1ec4d7fcb66a017 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sat, 6 Jun 2015 00:43:52 +0300 Subject: [PATCH 08/47] Fix imports. --- src/pytest_cover/embed.py | 2 +- src/pytest_cover/engine.py | 7 ++++--- src/pytest_cover/plugin.py | 18 +++++++++--------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/pytest_cover/embed.py b/src/pytest_cover/embed.py index f91ad34c..a09aa8ad 100644 --- a/src/pytest_cover/embed.py +++ b/src/pytest_cover/embed.py @@ -17,7 +17,7 @@ UNIQUE_SEP = '084031f3d2994d40a88c8b699b69e148' -import cov_core # noqa: register multiprocessing handler +from . import engine # noqa: register multiprocessing handler def init(): diff --git a/src/pytest_cover/engine.py b/src/pytest_cover/engine.py index b948178a..68eeea01 100644 --- a/src/pytest_cover/engine.py +++ b/src/pytest_cover/engine.py @@ -1,7 +1,6 @@ """Coverage controllers for use by pytest-cov and nose-cov.""" -from cov_core_init import UNIQUE_SEP -import cov_core_init + import coverage import socket import sys @@ -9,7 +8,8 @@ def multiprocessing_start(obj): - cov = cov_core_init.init() + from . import embed + cov = embed.init() if cov: import multiprocessing.util multiprocessing.util.Finalize( @@ -47,6 +47,7 @@ def __init__(self, cov_source, cov_report, cov_config, config=None, nodeid=None) def set_env(self): """Put info about coverage into the env so that subprocesses can activate coverage.""" + from .embed import UNIQUE_SEP if self.cov_source is None: os.environ['COV_CORE_SOURCE'] = '' diff --git a/src/pytest_cover/plugin.py b/src/pytest_cover/plugin.py index 289a8223..d85c5228 100644 --- a/src/pytest_cover/plugin.py +++ b/src/pytest_cover/plugin.py @@ -4,12 +4,12 @@ import pytest -import cov_core -import cov_core_init +from . import engine +from . import embed class CoverageError(Exception): - '''Indicates that our coverage is too low''' + """Indicates that our coverage is too low""" def pytest_addoption(parser): @@ -92,15 +92,15 @@ def __init__(self, options, pluginmanager, start=True): getattr(options, 'distload', False) or getattr(options, 'dist', 'no') != 'no') if is_dist and start: - self.start(cov_core.DistMaster) + self.start(engine.DistMaster) elif start: - self.start(cov_core.Central) + self.start(engine.Central) # slave is started in pytest hook def start(self, controller_cls, config=None, nodeid=None): if config is None: - # fake config option for cov_core + # fake config option for engine class Config(object): option = self.options @@ -122,7 +122,7 @@ def pytest_sessionstart(self, session): if is_slave: nodeid = session.config.slaveinput.get('slaveid', getattr(session, 'nodeid')) - self.start(cov_core.DistSlave, session.config, nodeid) + self.start(engine.DistSlave, session.config, nodeid) def pytest_configure_node(self, node): """Delegate to our implementation. @@ -163,11 +163,11 @@ def pytest_runtest_setup(self, item): if os.getpid() != self.pid: # test is run in another process than session, run # coverage manually - self.cov = cov_core_init.init() + self.cov = embed.init() def pytest_runtest_teardown(self, item): if self.cov is not None: - cov_core.multiprocessing_finish(self.cov) + engine.multiprocessing_finish(self.cov) self.cov = None From 0fdd8a3d44f3cacec157317a691f54c6083fc605 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sat, 6 Jun 2015 00:44:02 +0300 Subject: [PATCH 09/47] Update readme about the --cov arg. --- README.rst | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.rst b/README.rst index 68e51c14..85e8695a 100644 --- a/README.rst +++ b/README.rst @@ -95,7 +95,7 @@ subprocesses. Running centralised testing:: - py.test --cov-source myproj tests/ + py.test --cov=myproj tests/ Shows a terminal report:: @@ -118,7 +118,7 @@ file system. Each slave will have it's subprocesses measured. Running distributed testing with dist mode set to load:: - py.test --cov-source myproj -n 2 tests/ + py.test --cov=myproj -n 2 tests/ Shows a terminal report:: @@ -134,7 +134,7 @@ Shows a terminal report:: Again but spread over different hosts and different directories:: - py.test --cov-source myproj --dist load + py.test --cov=myproj --dist load --tx ssh=memedough@host1//chdir=testenv1 --tx ssh=memedough@host2//chdir=/tmp/testenv2//python=/tmp/env1/bin/python --rsyncdir myproj --rsyncdir tests --rsync examples @@ -161,7 +161,7 @@ environments. Running distributed testing with dist mode set to each:: - py.test --cov-source myproj --dist each + py.test --cov=myproj --dist each --tx popen//chdir=/tmp/testenv3//python=/usr/local/python27/bin/python --tx ssh=memedough@host2//chdir=/tmp/testenv4//python=/tmp/env2/bin/python --rsyncdir myproj --rsyncdir tests --rsync examples @@ -191,7 +191,7 @@ annotated source code. The terminal report without line numbers (default):: - py.test --cov-report term --cov-source myproj tests/ + py.test --cov-report term --cov=myproj tests/ -------------------- coverage: platform linux2, python 2.6.4-final-0 --------------------- Name Stmts Miss Cover @@ -205,7 +205,7 @@ The terminal report without line numbers (default):: The terminal report with line numbers:: - py.test --cov-report term-missing --cov-source myproj tests/ + py.test --cov-report term-missing --cov=myproj tests/ -------------------- coverage: platform linux2, python 2.6.4-final-0 --------------------- Name Stmts Miss Cover Missing @@ -222,11 +222,11 @@ These three report options output to files without showing anything on the termi py.test --cov-report html --cov-report xml --cov-report annotate - --cov-source myproj tests/ + --cov=myproj tests/ The final report option can also suppress printing to the terminal:: - py.test --cov-report= --cov-source myproj tests/ + py.test --cov-report= --cov=myproj tests/ This mode can be especially useful on continuous integration servers, where a coverage file is needed for subsequent processing, but no local report needs to be viewed. For example, @@ -251,7 +251,7 @@ For example if tests are contained within the directory tree being measured the excluded if desired by using a .coveragerc file with the omit option set:: py.test --cov-config .coveragerc - --cov-source myproj + --cov=myproj myproj/tests/ Where the .coveragerc file contains file globs:: @@ -285,4 +285,4 @@ Acknowledgements ---------------- `Marc Schlaich` for creating `pytest-cov (and cov-core) `_. -This plugin is a merge of those two packages with other fixes. \ No newline at end of file +This plugin is a merge of those two packages with other fixes. From a4a0d0a1c19265a6db6dd1f16b7b6623518ecd26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sat, 6 Jun 2015 00:44:14 +0300 Subject: [PATCH 10/47] Packaging fixes. --- setup.cfg | 1 + setup.py | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index 1b2705ee..32f9ed12 100644 --- a/setup.cfg +++ b/setup.cfg @@ -22,6 +22,7 @@ norecursedirs = build south_migrations migrations + example python_files = test_*.py *_test.py diff --git a/setup.py b/setup.py index f37d3b84..2dada20a 100644 --- a/setup.py +++ b/setup.py @@ -3,17 +3,22 @@ from __future__ import absolute_import, print_function import io -import os +from itertools import chain import re from glob import glob from os.path import basename from os.path import dirname from os.path import join -from os.path import relpath from os.path import splitext +from distutils.command.build import build +from setuptools import Command from setuptools import find_packages from setuptools import setup +from setuptools.command.develop import develop +from setuptools.command.install_lib import install_lib +from setuptools.command.easy_install import easy_install + def read(*names, **kwargs): return io.open( @@ -118,6 +123,9 @@ def run(self): extras_require={ }, entry_points={ + 'pytest11': [ + 'pytest_cov = pytest_cover.plugin', + ], 'console_scripts': [ ] }, From d4681d55e894f4eff8427689c043cdde109dc5d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sat, 6 Jun 2015 00:44:19 +0300 Subject: [PATCH 11/47] Add missing deps. --- tox.ini | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 9896ed03..ac24b3da 100644 --- a/tox.ini +++ b/tox.ini @@ -25,7 +25,9 @@ passenv = deps = pytest pytest-capturelog - pytest-cov + coverage + virtualenv + pytest-xdist commands = {posargs:py.test --cov=src --cov-report=term-missing -vv} usedevelop = true From 3dd5f86b3d0bb48489fad1426d2a687c8acec5c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sat, 6 Jun 2015 00:45:01 +0300 Subject: [PATCH 12/47] Add pth files. --- src/pytest-cover.embed | 10 ++++++++++ src/pytest-cover.pth | 1 + 2 files changed, 11 insertions(+) create mode 100644 src/pytest-cover.embed create mode 100644 src/pytest-cover.pth diff --git a/src/pytest-cover.embed b/src/pytest-cover.embed new file mode 100644 index 00000000..5e5fa729 --- /dev/null +++ b/src/pytest-cover.embed @@ -0,0 +1,10 @@ +if 'COV_CORE_SOURCE' in os.environ: + try: + from pytest_cover.embed import init + init() + except ImportError: + sys.stderr.write( + "Failed to setup coverage." + "Sources: {[COV_CORE_SOURCE]!r}" + "Config: {[COV_CORE_CONFIG]!r}" + "Exception: {!r}\n".format(os.environ, exc)) diff --git a/src/pytest-cover.pth b/src/pytest-cover.pth new file mode 100644 index 00000000..18376552 --- /dev/null +++ b/src/pytest-cover.pth @@ -0,0 +1 @@ +import os, sys;exec('if \'COV_CORE_SOURCE\' in os.environ:\n try:\n from pytest_cover.embed import init\n init()\n except ImportError:\n sys.stderr.write(\n "Failed to setup coverage."\n "Sources: {[COV_CORE_SOURCE]!r}"\n "Config: {[COV_CORE_CONFIG]!r}"\n "Exception: {!r}\\n".format(os.environ, exc))\n') \ No newline at end of file From 9489bb5b43ae12c229be433e14607019f85ef556 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sat, 6 Jun 2015 00:51:20 +0300 Subject: [PATCH 13/47] Fix config.getvalue check. --- src/pytest_cover/plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pytest_cover/plugin.py b/src/pytest_cover/plugin.py index d85c5228..2e674ceb 100644 --- a/src/pytest_cover/plugin.py +++ b/src/pytest_cover/plugin.py @@ -58,7 +58,7 @@ def pytest_load_initial_conftests(early_config, parser, args): def pytest_configure(config): """Activate coverage plugin if appropriate.""" - if config.getvalue('cov'): + if config.getvalue('cov_source'): if not config.pluginmanager.hasplugin('_cov'): plugin = CovPlugin(config.option, config.pluginmanager, start=False) From 742baa7a07f2e9bda7ecc2ce5e963c51267e4a60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sat, 6 Jun 2015 01:06:35 +0300 Subject: [PATCH 14/47] Fix heading levels and correct names. --- README.rst | 72 ++++++++++++++++++++++++++---------------------------- 1 file changed, 35 insertions(+), 37 deletions(-) diff --git a/README.rst b/README.rst index 85e8695a..8de31d54 100644 --- a/README.rst +++ b/README.rst @@ -2,52 +2,52 @@ pytest-cover =============================== -| |docs| |travis| |appveyor| |coveralls| +| |docs| |travis| |appveyor| | |version| |downloads| |wheel| |supported-versions| |supported-implementations| -.. |docs| image:: https://readthedocs.org/projects/pytest-coverer/badge/?style=flat - :target: https://readthedocs.org/projects/pytest-coverer +.. |docs| image:: https://readthedocs.org/projects/pytest-cover/badge/?style=flat + :target: https://readthedocs.org/projects/pytest-cover :alt: Documentation Status -.. |travis| image:: http://img.shields.io/travis/ionelmc/pytest-coverer/master.png?style=flat +.. |travis| image:: http://img.shields.io/travis/ionelmc/pytest-cover/master.png?style=flat :alt: Travis-CI Build Status - :target: https://travis-ci.org/ionelmc/pytest-coverer + :target: https://travis-ci.org/ionelmc/pytest-cover -.. |appveyor| image:: https://ci.appveyor.com/api/projects/status/github/ionelmc/pytest-coverer?branch=master +.. |appveyor| image:: https://ci.appveyor.com/api/projects/status/github/ionelmc/pytest-cover?branch=master :alt: AppVeyor Build Status - :target: https://ci.appveyor.com/project/ionelmc/pytest-coverer + :target: https://ci.appveyor.com/project/ionelmc/pytest-cover -.. |coveralls| image:: http://img.shields.io/coveralls/ionelmc/pytest-coverer/master.png?style=flat +.. |coveralls| image:: http://img.shields.io/coveralls/ionelmc/pytest-cover/master.png?style=flat :alt: Coverage Status - :target: https://coveralls.io/r/ionelmc/pytest-coverer + :target: https://coveralls.io/r/ionelmc/pytest-cover -.. |landscape| image:: https://landscape.io/github/ionelmc/pytest-coverer/master/landscape.svg?style=flat - :target: https://landscape.io/github/ionelmc/pytest-coverer/master +.. |landscape| image:: https://landscape.io/github/ionelmc/pytest-cover/master/landscape.svg?style=flat + :target: https://landscape.io/github/ionelmc/pytest-cover/master :alt: Code Quality Status -.. |version| image:: http://img.shields.io/pypi/v/pytest-coverer.png?style=flat +.. |version| image:: http://img.shields.io/pypi/v/pytest-cover.png?style=flat :alt: PyPI Package latest release - :target: https://pypi.python.org/pypi/pytest-coverer + :target: https://pypi.python.org/pypi/pytest-cover -.. |downloads| image:: http://img.shields.io/pypi/dm/pytest-coverer.png?style=flat +.. |downloads| image:: http://img.shields.io/pypi/dm/pytest-cover.png?style=flat :alt: PyPI Package monthly downloads - :target: https://pypi.python.org/pypi/pytest-coverer + :target: https://pypi.python.org/pypi/pytest-cover -.. |wheel| image:: https://pypip.in/wheel/pytest-coverer/badge.png?style=flat +.. |wheel| image:: https://pypip.in/wheel/pytest-cover/badge.png?style=flat :alt: PyPI Wheel - :target: https://pypi.python.org/pypi/pytest-coverer + :target: https://pypi.python.org/pypi/pytest-cover -.. |supported-versions| image:: https://pypip.in/py_versions/pytest-coverer/badge.png?style=flat +.. |supported-versions| image:: https://pypip.in/py_versions/pytest-cover/badge.png?style=flat :alt: Supported versions - :target: https://pypi.python.org/pypi/pytest-coverer + :target: https://pypi.python.org/pypi/pytest-cover -.. |supported-implementations| image:: https://pypip.in/implementation/pytest-coverer/badge.png?style=flat +.. |supported-implementations| image:: https://pypip.in/implementation/pytest-cover/badge.png?style=flat :alt: Supported imlementations - :target: https://pypi.python.org/pypi/pytest-coverer + :target: https://pypi.python.org/pypi/pytest-cover -.. |scrutinizer| image:: https://img.shields.io/scrutinizer/g/ionelmc/pytest-coverer/master.png?style=flat +.. |scrutinizer| image:: https://img.shields.io/scrutinizer/g/ionelmc/pytest-cover/master.png?style=flat :alt: Scrutinizer Status - :target: https://scrutinizer-ci.com/g/ionelmc/pytest-coverer/ + :target: https://scrutinizer-ci.com/g/ionelmc/pytest-cover/ Pytest plugin for measuring coverage. Forked from `pytest-cov `_. @@ -61,7 +61,7 @@ through coverage's config file. Installation ------------- +============ Install with pip:: @@ -78,17 +78,17 @@ For distributed testing support install pytest-xdist:: Uninstallation --------------- +============== Uninstall with pip:: pip uninstall pytest-cover Usage ------ +===== Centralised Testing -~~~~~~~~~~~~~~~~~~~ +------------------- Centralised testing will report on the combined coverage of the main process and all of it's subprocesses. @@ -110,7 +110,7 @@ Shows a terminal report:: Distributed Testing: Load -~~~~~~~~~~~~~~~~~~~~~~~~~ +------------------------- Distributed testing with dist mode set to load will report on the combined coverage of all slaves. The slaves may be spread out over any number of hosts and each slave may be located anywhere on the @@ -153,7 +153,7 @@ Shows a terminal report:: Distributed Testing: Each -~~~~~~~~~~~~~~~~~~~~~~~~~ +------------------------- Distributed testing with dist mode set to each will report on the combined coverage of all slaves. Since each slave is running all tests this allows generating a combined coverage report for multiple @@ -182,7 +182,7 @@ Shows a terminal report:: Reporting ---------- +========= It is possible to generate any combination of the reports for a single test run. @@ -233,7 +233,7 @@ is needed for subsequent processing, but no local report needs to be viewed. For tests run on Travis-CI could produce a .coverage file for use with Coveralls. Coverage Data File ------------------- +================== The data file is erased at the beginning of testing to ensure clean data for each test run. @@ -242,7 +242,7 @@ examine it. Coverage Config File --------------------- +==================== This plugin provides a clean minimal set of command line options that are added to pytest. For further control of coverage use a coverage config file. @@ -267,9 +267,8 @@ Note that this plugin controls some options and setting the option in the config effect. These include specifying source to be measured (source option) and all data file handling (data_file and parallel options). - Limitations ------------ +=========== For distributed testing the slaves must have the pytest-cover package installed. This is needed since the plugin must be registered through setuptools for pytest to start the plugin on the @@ -280,9 +279,8 @@ subprocess. The python used by the subprocess must have pytest-cover installed. do normal site initialisation so that the environment variables can be detected and coverage started. - Acknowledgements ----------------- +================ -`Marc Schlaich` for creating `pytest-cov (and cov-core) `_. +`Marc Schlaich` and everyone else for contributing and creating `pytest-cov (and cov-core) `_. This plugin is a merge of those two packages with other fixes. From a208b922a7f570e893bdf86602230dedb3065962 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sat, 6 Jun 2015 01:06:53 +0300 Subject: [PATCH 15/47] Fix test on python 2.6. --- tests/test_pytest_cover.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_pytest_cover.py b/tests/test_pytest_cover.py index e7ad85f7..eace33eb 100644 --- a/tests/test_pytest_cover.py +++ b/tests/test_pytest_cover.py @@ -332,7 +332,7 @@ def test_dist_missing_data(testdir): exe = os.path.join(venv_path, 'Scripts', 'python.exe') else: exe = os.path.join(venv_path, 'bin', 'python') - subprocess.check_call([exe, '-mpip', 'install', 'py', 'pytest']) + subprocess.check_call([exe, '-mpip' if sys.version_info >= (2, 7) else '-mpip.__main__', 'install', 'py', 'pytest']) script = testdir.makepyfile(SCRIPT) result = testdir.runpytest('-v', From d935aa5281deeb584ea56e37f476933e2a0fe311 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sat, 6 Jun 2015 01:07:06 +0300 Subject: [PATCH 16/47] Remove un-necessary tox envs. --- setup.cfg | 1 + tox.ini | 29 ++--------------------------- 2 files changed, 3 insertions(+), 27 deletions(-) diff --git a/setup.cfg b/setup.cfg index 32f9ed12..c6c0e2bc 100644 --- a/setup.cfg +++ b/setup.cfg @@ -32,6 +32,7 @@ addopts = --strict --ignore=docs/conf.py --ignore=setup.py + --ignore=src --ignore=ci --doctest-modules --doctest-glob=\*.rst diff --git a/tox.ini b/tox.ini index ac24b3da..7b12ca3f 100644 --- a/tox.ini +++ b/tox.ini @@ -5,7 +5,6 @@ envlist = clean, check, {2.6,2.7,3.3,3.4,pypy}, - {2.6,2.7,3.3,3.4,pypy}-nocover, report, docs @@ -29,8 +28,8 @@ deps = virtualenv pytest-xdist commands = - {posargs:py.test --cov=src --cov-report=term-missing -vv} -usedevelop = true + {posargs:py.test -vv} +usedevelop = false [testenv:spell] setenv = @@ -88,28 +87,4 @@ commands = coverage erase usedevelop = true deps = coverage -[testenv:2.6-nocover] -commands = - {posargs:py.test -vv --ignore=src} -usedevelop = false - -[testenv:2.7-nocover] -commands = - {posargs:py.test -vv --ignore=src} -usedevelop = false - -[testenv:3.3-nocover] -commands = - {posargs:py.test -vv --ignore=src} -usedevelop = false - -[testenv:3.4-nocover] -commands = - {posargs:py.test -vv --ignore=src} -usedevelop = false - -[testenv:pypy-nocover] -commands = - {posargs:py.test -vv --ignore=src} -usedevelop = false From d73b543dd81298463b48bb04a66efcf028343f21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sat, 6 Jun 2015 01:07:21 +0300 Subject: [PATCH 17/47] Update changelog and authorship. --- AUTHORS.rst | 10 +++++++++- CHANGELOG.rst | 14 ++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index 0e54887e..f46a017f 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -1,5 +1,13 @@ - Authors ======= +* Marc Schlaich - http://www.schlamar.org/ +* Rick van Hattem - http://wol.ph/ +* Buck Evan - https://github.com/bukzor +* Eric Larson - http://larsoner.com/ +* Marc Abramowitz - http://marc-abramowitz.com/ +* Thomas Kluyver - https://github.com/takluyver +* Guillaume Ayoub - http://www.yabz.fr/ +* Federico Ceratto - http://firelet.net/ +* Josh Kalderimis - http://blog.cookiestack.com/ * Ionel Cristian Mărieș - http://blog.ionelmc.ro diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e1310db5..67240076 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,8 +1,14 @@ - Changelog ========= -0.1.0 (2015-06-05) ------------------------------------------ +1.0.0 (2015-06-05) +------------------ + +* Forked from the `2.0` branch of https://github.com/schlamar/pytest-cov/ +* Fixed `.pth` installation to work in all cases (install, easy_install, wheels, develop etc). +* Fixed `.pth` uninstallation to work for wheel installs. +* Reverted the unreleased ``--cov=path`` deprecation. +* Removed the unreleased addition of ``--cov-source=path``. + + -* First release on PyPI. From 004c99d83e847f0e801effafee03ad20632cb81a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sat, 6 Jun 2015 01:07:26 +0300 Subject: [PATCH 18/47] Fix manifest. --- MANIFEST.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MANIFEST.in b/MANIFEST.in index f44be4b5..69475e23 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,5 @@ graft docs -graft examples +graft example graft src graft ci graft tests From 12b2abcd94e5bd45a33add5875599f0a0f46bf61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sat, 6 Jun 2015 01:36:40 +0300 Subject: [PATCH 19/47] Update target version --- setup.py | 2 +- src/pytest_cover/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 2dada20a..ffa67eb8 100644 --- a/setup.py +++ b/setup.py @@ -82,7 +82,7 @@ def run(self): setup( name='pytest-cover', - version='0.1.0', + version='1.0.0', license='MIT', description='Pytest plugin for measuring coverage. Forked from `pytest-cov`.', long_description='%s\n%s' % (read('README.rst'), re.sub(':[a-z]+:`~?(.*?)`', r'``\1``', read('CHANGELOG.rst'))), diff --git a/src/pytest_cover/__init__.py b/src/pytest_cover/__init__.py index 3dc1f76b..5becc17c 100644 --- a/src/pytest_cover/__init__.py +++ b/src/pytest_cover/__init__.py @@ -1 +1 @@ -__version__ = "0.1.0" +__version__ = "1.0.0" From 824aa4fbdbf41acf7e22049081575ef0ddc209e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sat, 6 Jun 2015 01:39:16 +0300 Subject: [PATCH 20/47] Use os.pathsep instead of some arbitrary string. Make things easier to read when debugging. --- src/pytest_cover/embed.py | 3 +-- src/pytest_cover/engine.py | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/pytest_cover/embed.py b/src/pytest_cover/embed.py index a09aa8ad..9cbfd75c 100644 --- a/src/pytest_cover/embed.py +++ b/src/pytest_cover/embed.py @@ -15,7 +15,6 @@ """ -UNIQUE_SEP = '084031f3d2994d40a88c8b699b69e148' from . import engine # noqa: register multiprocessing handler @@ -42,7 +41,7 @@ def init(): if not cov_source: cov_source = None else: - cov_source = cov_source.split(UNIQUE_SEP) + cov_source = cov_source.split(os.pathsep) # Activate coverage for this process. cov = coverage.coverage(source=cov_source, diff --git a/src/pytest_cover/engine.py b/src/pytest_cover/engine.py index 68eeea01..3be20c6a 100644 --- a/src/pytest_cover/engine.py +++ b/src/pytest_cover/engine.py @@ -47,12 +47,10 @@ def __init__(self, cov_source, cov_report, cov_config, config=None, nodeid=None) def set_env(self): """Put info about coverage into the env so that subprocesses can activate coverage.""" - from .embed import UNIQUE_SEP - if self.cov_source is None: os.environ['COV_CORE_SOURCE'] = '' else: - os.environ['COV_CORE_SOURCE'] = UNIQUE_SEP.join(self.cov_source) + os.environ['COV_CORE_SOURCE'] = os.pathsep.join(self.cov_source) os.environ['COV_CORE_CONFIG'] = self.cov_config @staticmethod From 4974160bb6fd8646292b7a5affb42bb01bbe3abe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sat, 6 Jun 2015 01:43:46 +0300 Subject: [PATCH 21/47] Move the multiprocessing fixups in embed.py. Fixes circular import issues (or the need for lazy imports). --- src/pytest_cover/embed.py | 75 ++++++++++++++++++++------------------ src/pytest_cover/engine.py | 27 +------------- src/pytest_cover/plugin.py | 5 +-- 3 files changed, 44 insertions(+), 63 deletions(-) diff --git a/src/pytest_cover/embed.py b/src/pytest_cover/embed.py index 9cbfd75c..3cfc4c74 100644 --- a/src/pytest_cover/embed.py +++ b/src/pytest_cover/embed.py @@ -13,44 +13,49 @@ that code coverage is being collected we activate coverage based on info passed via env vars. """ +import os +def multiprocessing_start(obj): + cov = init() + if cov: + multiprocessing.util.Finalize(None, multiprocessing_finish, args=(cov,), exitpriority=1000) -from . import engine # noqa: register multiprocessing handler +def multiprocessing_finish(cov): + cov.stop() + cov.save() -def init(): - # Any errors encountered should only prevent coverage from - # starting, it should not cause python to complain that importing - # of site failed. - try: - - # Only continue if ancestor process has set everything needed in - # the env. - import os - - cov_source = os.environ.get('COV_CORE_SOURCE') - cov_config = os.environ.get('COV_CORE_CONFIG') - if cov_config: - - # Import what we need to activate coverage. - import coverage - - # Determine all source roots. - if not cov_source: - cov_source = None - else: - cov_source = cov_source.split(os.pathsep) - - # Activate coverage for this process. - cov = coverage.coverage(source=cov_source, - data_suffix=True, - config_file=cov_config, - auto_data=True) - cov.erase() - cov.start() - return cov - - except Exception: - pass +try: + import multiprocessing.util +except ImportError: + pass +else: + multiprocessing.util.register_after_fork(multiprocessing_start, multiprocessing_start) + + +def init(): + # Only continue if ancestor process has set everything needed in + # the env. + + cov_source = os.environ.get('COV_CORE_SOURCE') + cov_config = os.environ.get('COV_CORE_CONFIG') + if cov_config: + # Import what we need to activate coverage. + import coverage + + # Determine all source roots. + if not cov_source: + cov_source = None + else: + cov_source = cov_source.split(os.pathsep) + + # Activate coverage for this process. + cov = coverage.coverage(source=cov_source, + data_suffix=True, + config_file=cov_config, + auto_data=True) + cov.erase() + cov.start() + return cov diff --git a/src/pytest_cover/engine.py b/src/pytest_cover/engine.py index 3be20c6a..b2121c08 100644 --- a/src/pytest_cover/engine.py +++ b/src/pytest_cover/engine.py @@ -1,32 +1,9 @@ """Coverage controllers for use by pytest-cov and nose-cov.""" - - -import coverage +import os import socket import sys -import os - -def multiprocessing_start(obj): - from . import embed - cov = embed.init() - if cov: - import multiprocessing.util - multiprocessing.util.Finalize( - None, multiprocessing_finish, args=(cov,), exitpriority=1000) - - -def multiprocessing_finish(cov): - cov.stop() - cov.save() - - -try: - import multiprocessing.util - multiprocessing.util.register_after_fork(multiprocessing_start, - multiprocessing_start) -except ImportError: - pass +import coverage class CovController(object): diff --git a/src/pytest_cover/plugin.py b/src/pytest_cover/plugin.py index 2e674ceb..7ce61037 100644 --- a/src/pytest_cover/plugin.py +++ b/src/pytest_cover/plugin.py @@ -1,11 +1,10 @@ """Coverage plugin for pytest.""" - import os import pytest -from . import engine from . import embed +from . import engine class CoverageError(Exception): @@ -167,7 +166,7 @@ def pytest_runtest_setup(self, item): def pytest_runtest_teardown(self, item): if self.cov is not None: - engine.multiprocessing_finish(self.cov) + embed.multiprocessing_finish(self.cov) self.cov = None From d8a12d91e2adae33e6bda91837cb46545e714c0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sat, 6 Jun 2015 01:48:44 +0300 Subject: [PATCH 22/47] Update CI conf. --- .travis.yml | 15 +++++---------- appveyor.yml | 38 -------------------------------------- 2 files changed, 5 insertions(+), 48 deletions(-) diff --git a/.travis.yml b/.travis.yml index 80caf6f2..915592f0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,16 +6,11 @@ env: LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so matrix: - TOXENV=check - - TOXENV=2.6,coveralls - - TOXENV=2.6-nocover - - TOXENV=2.7,coveralls - - TOXENV=2.7-nocover - - TOXENV=3.3,coveralls - - TOXENV=3.3-nocover - - TOXENV=3.4,coveralls - - TOXENV=3.4-nocover - - TOXENV=pypy,coveralls - - TOXENV=pypy-nocover + - TOXENV=2.6 + - TOXENV=2.7 + - TOXENV=3.3 + - TOXENV=3.4 + - TOXENV=pypy before_install: - python --version - virtualenv --version diff --git a/appveyor.yml b/appveyor.yml index 251e22f8..ec342220 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -20,18 +20,6 @@ environment: PYTHON_HOME: "C:\\Python27-x64" PYTHON_VERSION: "2.7" PYTHON_ARCH: "64" - - TOXENV: "2.7-nocover" - TOXPYTHON: "C:\\Python27\\python.exe" - WINDOWS_SDK_VERSION: "v7.0" - PYTHON_HOME: "C:\\Python27" - PYTHON_VERSION: "2.7" - PYTHON_ARCH: "32" - - TOXENV: "2.7-nocover" - TOXPYTHON: "C:\\Python27-x64\\python.exe" - WINDOWS_SDK_VERSION: "v7.0" - PYTHON_HOME: "C:\\Python27-x64" - PYTHON_VERSION: "2.7" - PYTHON_ARCH: "64" - TOXENV: "3.3" TOXPYTHON: "C:\\Python33\\python.exe" WINDOWS_SDK_VERSION: "v7.1" @@ -44,18 +32,6 @@ environment: PYTHON_HOME: "C:\\Python33-x64" PYTHON_VERSION: "3.3" PYTHON_ARCH: "64" - - TOXENV: "3.3-nocover" - TOXPYTHON: "C:\\Python33\\python.exe" - WINDOWS_SDK_VERSION: "v7.1" - PYTHON_HOME: "C:\\Python33" - PYTHON_VERSION: "3.3" - PYTHON_ARCH: "32" - - TOXENV: "3.3-nocover" - TOXPYTHON: "C:\\Python33-x64\\python.exe" - WINDOWS_SDK_VERSION: "v7.1" - PYTHON_HOME: "C:\\Python33-x64" - PYTHON_VERSION: "3.3" - PYTHON_ARCH: "64" - TOXENV: "3.4" TOXPYTHON: "C:\\Python34\\python.exe" WINDOWS_SDK_VERSION: "v7.1" @@ -68,18 +44,6 @@ environment: PYTHON_HOME: "C:\\Python34-x64" PYTHON_VERSION: "3.4" PYTHON_ARCH: "64" - - TOXENV: "3.4-nocover" - TOXPYTHON: "C:\\Python34\\python.exe" - WINDOWS_SDK_VERSION: "v7.1" - PYTHON_HOME: "C:\\Python34" - PYTHON_VERSION: "3.4" - PYTHON_ARCH: "32" - - TOXENV: "3.4-nocover" - TOXPYTHON: "C:\\Python34-x64\\python.exe" - WINDOWS_SDK_VERSION: "v7.1" - PYTHON_HOME: "C:\\Python34-x64" - PYTHON_VERSION: "3.4" - PYTHON_ARCH: "64" init: - "ECHO %TOXENV%" - ps: "ls C:\\Python*" @@ -90,7 +54,5 @@ test_script: - "%PYTHON_HOME%\\Scripts\\virtualenv --version" - "%PYTHON_HOME%\\Scripts\\pip --version" - "%WITH_COMPILER% %PYTHON_HOME%\\Scripts\\tox" -after_test: - - "IF \"%TOXENV:~-8,8%\" == \"-nocover\" %WITH_COMPILER% %TOXPYTHON% setup.py bdist_wheel" artifacts: - path: dist\* From 308f61f7361b7f664e2f314f8c4ffd69e8e47df4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sat, 6 Jun 2015 03:03:30 +0300 Subject: [PATCH 23/47] Add missing deps. --- setup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.py b/setup.py index ffa67eb8..dfb52a5d 100644 --- a/setup.py +++ b/setup.py @@ -119,6 +119,8 @@ def run(self): 'cover', 'coverage', 'pytest', 'py.test', 'distributed', 'parallel', ], install_requires=[ + 'pytest>=2.6.0', + 'coverage>=3.7.1' ], extras_require={ }, From e807665b5c09f303e4433eeca7c8a2c30f1c8290 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sat, 6 Jun 2015 03:35:54 +0300 Subject: [PATCH 24/47] Test coverage 4.0 too. Loosen up a bit the tests (seems that in the report with 4.0 files show up with extension). --- .travis.yml | 15 ++++++++---- appveyor.yml | 50 +++++++++++++++++++++++++++++++++----- tests/test_pytest_cover.py | 36 +++++++++++++-------------- tox.ini | 33 ++++++------------------- 4 files changed, 79 insertions(+), 55 deletions(-) diff --git a/.travis.yml b/.travis.yml index 915592f0..1224b274 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,11 +6,16 @@ env: LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so matrix: - TOXENV=check - - TOXENV=2.6 - - TOXENV=2.7 - - TOXENV=3.3 - - TOXENV=3.4 - - TOXENV=pypy + - TOXENV=2.6-37 + - TOXENV=2.7-37 + - TOXENV=3.3-37 + - TOXENV=3.4-37 + - TOXENV=pypy-37 + - TOXENV=2.6-40 + - TOXENV=2.7-40 + - TOXENV=3.3-40 + - TOXENV=3.4-40 + - TOXENV=pypy-40 before_install: - python --version - virtualenv --version diff --git a/appveyor.yml b/appveyor.yml index ec342220..2d5de003 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,37 +8,75 @@ environment: PYTHON_HOME: "C:\\Python27" PYTHON_VERSION: "2.7" PYTHON_ARCH: "32" - - TOXENV: "2.7" + + - TOXENV: "2.7-37" TOXPYTHON: "C:\\Python27\\python.exe" WINDOWS_SDK_VERSION: "v7.0" PYTHON_HOME: "C:\\Python27" PYTHON_VERSION: "2.7" PYTHON_ARCH: "32" - - TOXENV: "2.7" + - TOXENV: "2.7-37" TOXPYTHON: "C:\\Python27-x64\\python.exe" WINDOWS_SDK_VERSION: "v7.0" PYTHON_HOME: "C:\\Python27-x64" PYTHON_VERSION: "2.7" PYTHON_ARCH: "64" - - TOXENV: "3.3" + - TOXENV: "3.3-37" TOXPYTHON: "C:\\Python33\\python.exe" WINDOWS_SDK_VERSION: "v7.1" PYTHON_HOME: "C:\\Python33" PYTHON_VERSION: "3.3" PYTHON_ARCH: "32" - - TOXENV: "3.3" + - TOXENV: "3.3-37" TOXPYTHON: "C:\\Python33-x64\\python.exe" WINDOWS_SDK_VERSION: "v7.1" PYTHON_HOME: "C:\\Python33-x64" PYTHON_VERSION: "3.3" PYTHON_ARCH: "64" - - TOXENV: "3.4" + - TOXENV: "3.4-37" TOXPYTHON: "C:\\Python34\\python.exe" WINDOWS_SDK_VERSION: "v7.1" PYTHON_HOME: "C:\\Python34" PYTHON_VERSION: "3.4" PYTHON_ARCH: "32" - - TOXENV: "3.4" + - TOXENV: "3.4-37" + TOXPYTHON: "C:\\Python34-x64\\python.exe" + WINDOWS_SDK_VERSION: "v7.1" + PYTHON_HOME: "C:\\Python34-x64" + PYTHON_VERSION: "3.4" + PYTHON_ARCH: "64" + + - TOXENV: "2.7-40" + TOXPYTHON: "C:\\Python27\\python.exe" + WINDOWS_SDK_VERSION: "v7.0" + PYTHON_HOME: "C:\\Python27" + PYTHON_VERSION: "2.7" + PYTHON_ARCH: "32" + - TOXENV: "2.7-40" + TOXPYTHON: "C:\\Python27-x64\\python.exe" + WINDOWS_SDK_VERSION: "v7.0" + PYTHON_HOME: "C:\\Python27-x64" + PYTHON_VERSION: "2.7" + PYTHON_ARCH: "64" + - TOXENV: "3.3-40" + TOXPYTHON: "C:\\Python33\\python.exe" + WINDOWS_SDK_VERSION: "v7.1" + PYTHON_HOME: "C:\\Python33" + PYTHON_VERSION: "3.3" + PYTHON_ARCH: "32" + - TOXENV: "3.3-40" + TOXPYTHON: "C:\\Python33-x64\\python.exe" + WINDOWS_SDK_VERSION: "v7.1" + PYTHON_HOME: "C:\\Python33-x64" + PYTHON_VERSION: "3.3" + PYTHON_ARCH: "64" + - TOXENV: "3.4-40" + TOXPYTHON: "C:\\Python34\\python.exe" + WINDOWS_SDK_VERSION: "v7.1" + PYTHON_HOME: "C:\\Python34" + PYTHON_VERSION: "3.4" + PYTHON_ARCH: "32" + - TOXENV: "3.4-40" TOXPYTHON: "C:\\Python34-x64\\python.exe" WINDOWS_SDK_VERSION: "v7.1" PYTHON_HOME: "C:\\Python34-x64" diff --git a/tests/test_pytest_cover.py b/tests/test_pytest_cover.py index eace33eb..82e70cdc 100644 --- a/tests/test_pytest_cover.py +++ b/tests/test_pytest_cover.py @@ -107,7 +107,7 @@ def test_central(testdir): result.stdout.fnmatch_lines([ '*- coverage: platform *, python * -*', - 'test_central * %s *' % SCRIPT_RESULT, + 'test_central* %s *' % SCRIPT_RESULT, '*10 passed*' ]) assert result.ret == 0 @@ -159,7 +159,7 @@ def test_central_nonspecific(testdir): result.stdout.fnmatch_lines([ '*- coverage: platform *, python * -*', - 'test_central_nonspecific * %s *' % SCRIPT_RESULT, + 'test_central_nonspecific* %s *' % SCRIPT_RESULT, '*10 passed*' ]) @@ -180,12 +180,12 @@ def test_central_coveragerc(testdir): result.stdout.fnmatch_lines([ '*- coverage: platform *, python * -*', - 'test_central_coveragerc * %s *' % SCRIPT_RESULT, + 'test_central_coveragerc* %s *' % SCRIPT_RESULT, '*10 passed*', ]) # single-module coverage report - assert result.stdout.lines[-3].startswith('test_central_coveragerc ') + assert result.stdout.lines[-3].startswith('test_central_coveragerc') assert result.ret == 0 @@ -215,7 +215,7 @@ def test_dist_collocated(testdir): result.stdout.fnmatch_lines([ '*- coverage: platform *, python * -*', - 'test_dist_collocated * %s *' % SCRIPT_RESULT, + 'test_dist_collocated* %s *' % SCRIPT_RESULT, '*10 passed*' ]) assert result.ret == 0 @@ -237,7 +237,7 @@ def test_dist_not_collocated(testdir): result.stdout.fnmatch_lines([ '*- coverage: platform *, python * -*', - 'test_dist_not_collocated * %s *' % SCRIPT_RESULT, + 'test_dist_not_collocated* %s *' % SCRIPT_RESULT, '*10 passed*' ]) assert result.ret == 0 @@ -255,8 +255,8 @@ def test_central_subprocess(testdir): result.stdout.fnmatch_lines([ '*- coverage: platform *, python * -*', - 'child_script * %s *' % CHILD_SCRIPT_RESULT, - 'parent_script * %s *' % PARENT_SCRIPT_RESULT, + 'child_script* %s *' % CHILD_SCRIPT_RESULT, + 'parent_script* %s *' % PARENT_SCRIPT_RESULT, ]) assert result.ret == 0 @@ -275,8 +275,8 @@ def test_dist_subprocess_collocated(testdir): result.stdout.fnmatch_lines([ '*- coverage: platform *, python * -*', - 'child_script * %s *' % CHILD_SCRIPT_RESULT, - 'parent_script * %s *' % PARENT_SCRIPT_RESULT, + 'child_script* %s *' % CHILD_SCRIPT_RESULT, + 'parent_script* %s *' % PARENT_SCRIPT_RESULT, ]) assert result.ret == 0 @@ -302,8 +302,8 @@ def test_dist_subprocess_not_collocated(testdir, tmpdir): result.stdout.fnmatch_lines([ '*- coverage: platform *, python * -*', - 'child_script * %s *' % CHILD_SCRIPT_RESULT, - 'parent_script * %s *' % PARENT_SCRIPT_RESULT, + 'child_script* %s *' % CHILD_SCRIPT_RESULT, + 'parent_script* %s *' % PARENT_SCRIPT_RESULT, ]) assert result.ret == 0 @@ -358,7 +358,7 @@ def test_funcarg(testdir): result.stdout.fnmatch_lines([ '*- coverage: platform *, python * -*', - 'test_funcarg * 3 * 100%*', + 'test_funcarg* 3 * 100%*', '*1 passed*' ]) assert result.ret == 0 @@ -388,7 +388,7 @@ def test_multiprocessing_subprocess(testdir): result.stdout.fnmatch_lines([ '*- coverage: platform *, python * -*', - 'test_multiprocessing_subprocess * 8 * 100%*', + 'test_multiprocessing_subprocess* 8 * 100%*', '*1 passed*' ]) assert result.ret == 0 @@ -415,7 +415,7 @@ def test_basic(): ''' -CONF_RESULT = 'mod * 2 * 100% *' +CONF_RESULT = 'mod* 2 * 100% *' def test_cover_conftest(testdir): @@ -475,7 +475,7 @@ def test_coveragerc(testdir): '--cov-report=term-missing', script) assert result.ret == 0 - result.stdout.fnmatch_lines(['test_coveragerc * %s' % EXCLUDED_RESULT]) + result.stdout.fnmatch_lines(['test_coveragerc* %s' % EXCLUDED_RESULT]) def test_coveragerc_dist(testdir): @@ -489,7 +489,7 @@ def test_coveragerc_dist(testdir): script) assert result.ret == 0 result.stdout.fnmatch_lines( - ['test_coveragerc_dist * %s' % EXCLUDED_RESULT]) + ['test_coveragerc_dist* %s' % EXCLUDED_RESULT]) CLEAR_ENVIRON_TEST = ''' @@ -534,7 +534,7 @@ def test_dist_boxed(testdir): result.stdout.fnmatch_lines([ '*- coverage: platform *, python * -*', - 'test_dist_boxed * %s*' % SCRIPT_SIMPLE_RESULT, + 'test_dist_boxed* %s*' % SCRIPT_SIMPLE_RESULT, '*1 passed*' ]) assert result.ret == 0 diff --git a/tox.ini b/tox.ini index 7b12ca3f..f922a5af 100644 --- a/tox.ini +++ b/tox.ini @@ -2,10 +2,8 @@ [tox] envlist = - clean, check, - {2.6,2.7,3.3,3.4,pypy}, - report, + {2.6,2.7,3.3,3.4,pypy}-{37,40}, docs [testenv] @@ -22,11 +20,14 @@ setenv = passenv = * deps = - pytest + pytest==2.7.1 pytest-capturelog - coverage + 37: coverage==3.7.1 + 40: coverage==4.0a5 virtualenv - pytest-xdist + pytest-xdist==1.12 +pip_pre = true + commands = {posargs:py.test -vv} usedevelop = false @@ -66,25 +67,5 @@ commands = check-manifest {toxinidir} flake8 src -[testenv:coveralls] -deps = - coveralls -usedevelop = true -commands = - coverage combine - coverage report - coveralls -[testenv:report] -basepython = python3.4 -commands = - coverage combine - coverage report -usedevelop = true -deps = coverage - -[testenv:clean] -commands = coverage erase -usedevelop = true -deps = coverage From e450a1cbc973b4a0a6c294085284c4eed0eb7c61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sat, 6 Jun 2015 22:23:55 +0300 Subject: [PATCH 25/47] Update changelog. --- CHANGELOG.rst | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 67240076..edea7f86 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,11 +4,18 @@ Changelog 1.0.0 (2015-06-05) ------------------ -* Forked from the `2.0` branch of https://github.com/schlamar/pytest-cov/ * Fixed `.pth` installation to work in all cases (install, easy_install, wheels, develop etc). * Fixed `.pth` uninstallation to work for wheel installs. * Reverted the unreleased ``--cov=path`` deprecation. * Removed the unreleased addition of ``--cov-source=path``. +----- + +* Forked from the `2.0` branch of https://github.com/schlamar/pytest-cov/ - fixes include: + + * No need to specify the source anymore via ``--cov``. The source settings from + ``.coveragerc`` will be used instead. + * Support for ``--cov-min``. + From 1c62766dbe60220de3398d146718a0eedaa087e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Thu, 18 Jun 2015 13:51:02 +0300 Subject: [PATCH 26/47] Add .env to ignores. --- .gitignore | 1 + setup.cfg | 1 + 2 files changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 88b9214b..8365f940 100644 --- a/.gitignore +++ b/.gitignore @@ -53,5 +53,6 @@ docs/_build .*.sw[po] .build .ve +.env .bootstrap *.bak diff --git a/setup.cfg b/setup.cfg index c6c0e2bc..e7e42f25 100644 --- a/setup.cfg +++ b/setup.cfg @@ -18,6 +18,7 @@ tag = True norecursedirs = .git .tox + .env dist build south_migrations From e6b30882672d9205f4ca8d6370b56ebe881001d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Thu, 18 Jun 2015 13:51:50 +0300 Subject: [PATCH 27/47] Change a bit test_central_nonspecific and the test to actually trigger library coverage. --- tests/test_pytest_cover.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_pytest_cover.py b/tests/test_pytest_cover.py index 82e70cdc..e6e16ef7 100644 --- a/tests/test_pytest_cover.py +++ b/tests/test_pytest_cover.py @@ -1,4 +1,5 @@ import os +from pprint import pprint import sys import virtualenv @@ -12,7 +13,7 @@ pytest_plugins = 'pytester', 'cov' SCRIPT = ''' -import sys +import sys, pprint def pytest_generate_tests(metafunc): for i in range(10): @@ -20,7 +21,7 @@ def pytest_generate_tests(metafunc): def test_foo(): x = True - assert x + assert pprint.pformat(x) # get some library coverage if sys.version_info[0] > 5: assert False ''' From e74f7d71516b526773e6939035ecee239f95b2be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sat, 20 Jun 2015 15:58:38 +0300 Subject: [PATCH 28/47] Reformat. --- tests/test_pytest_cover.py | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/tests/test_pytest_cover.py b/tests/test_pytest_cover.py index e6e16ef7..e657eb56 100644 --- a/tests/test_pytest_cover.py +++ b/tests/test_pytest_cover.py @@ -1,5 +1,4 @@ import os -from pprint import pprint import sys import virtualenv @@ -9,7 +8,6 @@ import subprocess import pytest_cover.plugin - pytest_plugins = 'pytester', 'cov' SCRIPT = ''' @@ -86,7 +84,6 @@ def test_run_target(): p.join() ''' - SCRIPT_FAIL = ''' def test_fail(): assert False @@ -110,7 +107,7 @@ def test_central(testdir): '*- coverage: platform *, python * -*', 'test_central* %s *' % SCRIPT_RESULT, '*10 passed*' - ]) + ]) assert result.ret == 0 @@ -162,7 +159,7 @@ def test_central_nonspecific(testdir): '*- coverage: platform *, python * -*', 'test_central_nonspecific* %s *' % SCRIPT_RESULT, '*10 passed*' - ]) + ]) # multi-module coverage report assert result.stdout.lines[-3].startswith('TOTAL ') @@ -183,7 +180,7 @@ def test_central_coveragerc(testdir): '*- coverage: platform *, python * -*', 'test_central_coveragerc* %s *' % SCRIPT_RESULT, '*10 passed*', - ]) + ]) # single-module coverage report assert result.stdout.lines[-3].startswith('test_central_coveragerc') @@ -218,7 +215,7 @@ def test_dist_collocated(testdir): '*- coverage: platform *, python * -*', 'test_dist_collocated* %s *' % SCRIPT_RESULT, '*10 passed*' - ]) + ]) assert result.ret == 0 @@ -240,7 +237,7 @@ def test_dist_not_collocated(testdir): '*- coverage: platform *, python * -*', 'test_dist_not_collocated* %s *' % SCRIPT_RESULT, '*10 passed*' - ]) + ]) assert result.ret == 0 @@ -258,7 +255,7 @@ def test_central_subprocess(testdir): '*- coverage: platform *, python * -*', 'child_script* %s *' % CHILD_SCRIPT_RESULT, 'parent_script* %s *' % PARENT_SCRIPT_RESULT, - ]) + ]) assert result.ret == 0 @@ -278,7 +275,7 @@ def test_dist_subprocess_collocated(testdir): '*- coverage: platform *, python * -*', 'child_script* %s *' % CHILD_SCRIPT_RESULT, 'parent_script* %s *' % PARENT_SCRIPT_RESULT, - ]) + ]) assert result.ret == 0 @@ -305,7 +302,7 @@ def test_dist_subprocess_not_collocated(testdir, tmpdir): '*- coverage: platform *, python * -*', 'child_script* %s *' % CHILD_SCRIPT_RESULT, 'parent_script* %s *' % PARENT_SCRIPT_RESULT, - ]) + ]) assert result.ret == 0 @@ -320,7 +317,7 @@ def test_empty_report(testdir): result.stdout.fnmatch_lines([ '*- coverage: platform *, python * -*', '*10 passed*' - ]) + ]) assert result.ret == 0 matching_lines = [line for line in result.outlines if '%' in line] assert not matching_lines @@ -345,7 +342,7 @@ def test_dist_missing_data(testdir): result.stdout.fnmatch_lines([ '*- coverage: failed slaves -*' - ]) + ]) assert result.ret == 0 @@ -361,7 +358,7 @@ def test_funcarg(testdir): '*- coverage: platform *, python * -*', 'test_funcarg* 3 * 100%*', '*1 passed*' - ]) + ]) assert result.ret == 0 @@ -373,7 +370,7 @@ def test_funcarg_not_active(testdir): result.stdout.fnmatch_lines([ '*1 passed*' - ]) + ]) assert result.ret == 0 @@ -391,7 +388,7 @@ def test_multiprocessing_subprocess(testdir): '*- coverage: platform *, python * -*', 'test_multiprocessing_subprocess* 8 * 100%*', '*1 passed*' - ]) + ]) assert result.ret == 0 @@ -537,7 +534,7 @@ def test_dist_boxed(testdir): '*- coverage: platform *, python * -*', 'test_dist_boxed* %s*' % SCRIPT_SIMPLE_RESULT, '*1 passed*' - ]) + ]) assert result.ret == 0 From 7ee700f9dc81339d2d4d40b0b1f272acf698d2ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sat, 20 Jun 2015 17:02:29 +0300 Subject: [PATCH 29/47] Change a bit the test so the external code is non-stdlib. --- tests/test_pytest_cover.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_pytest_cover.py b/tests/test_pytest_cover.py index e657eb56..cbe147e4 100644 --- a/tests/test_pytest_cover.py +++ b/tests/test_pytest_cover.py @@ -11,7 +11,7 @@ pytest_plugins = 'pytester', 'cov' SCRIPT = ''' -import sys, pprint +import sys, pytest def pytest_generate_tests(metafunc): for i in range(10): @@ -19,7 +19,7 @@ def pytest_generate_tests(metafunc): def test_foo(): x = True - assert pprint.pformat(x) # get some library coverage + pytest.importorskip('sys') # get some library coverage if sys.version_info[0] > 5: assert False ''' From 2f9c530c07778b87650dc9fea2e2bc86c43f4272 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sat, 20 Jun 2015 17:31:50 +0300 Subject: [PATCH 30/47] Use a helper module in a different location to test that inclue paths are properly applied. --- tests/helper.py | 3 +++ tests/test_pytest_cover.py | 4 ++-- tox.ini | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 tests/helper.py diff --git a/tests/helper.py b/tests/helper.py new file mode 100644 index 00000000..3e7da4bb --- /dev/null +++ b/tests/helper.py @@ -0,0 +1,3 @@ +def do_stuff(): + a = 1 + return a diff --git a/tests/test_pytest_cover.py b/tests/test_pytest_cover.py index cbe147e4..61c8ba13 100644 --- a/tests/test_pytest_cover.py +++ b/tests/test_pytest_cover.py @@ -11,7 +11,7 @@ pytest_plugins = 'pytester', 'cov' SCRIPT = ''' -import sys, pytest +import sys, helper def pytest_generate_tests(metafunc): for i in range(10): @@ -19,7 +19,7 @@ def pytest_generate_tests(metafunc): def test_foo(): x = True - pytest.importorskip('sys') # get some library coverage + helper.do_stuff() # get some coverage in some other completely different location if sys.version_info[0] > 5: assert False ''' diff --git a/tox.ini b/tox.ini index f922a5af..0e171104 100644 --- a/tox.ini +++ b/tox.ini @@ -26,6 +26,7 @@ deps = 40: coverage==4.0a5 virtualenv pytest-xdist==1.12 + pytest-cache==1.0.0 pip_pre = true commands = From 8c4c5b8ab7cebbaa6e7a21b1f6733a0eaa1ad370 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sun, 21 Jun 2015 21:14:48 +0300 Subject: [PATCH 31/47] Use new 4.0 release. --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 0e171104..e441da6b 100644 --- a/tox.ini +++ b/tox.ini @@ -23,7 +23,7 @@ deps = pytest==2.7.1 pytest-capturelog 37: coverage==3.7.1 - 40: coverage==4.0a5 + 40: coverage==4.0a6 virtualenv pytest-xdist==1.12 pytest-cache==1.0.0 From 098ed9b094d7df2bae5f9dfc0493829df930a0ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sun, 28 Jun 2015 19:56:32 +0300 Subject: [PATCH 32/47] Test that --cov-report=term will report missing lines if .coveragerc has show_missing=true. Ref #1. --- tests/test_pytest_cover.py | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/tests/test_pytest_cover.py b/tests/test_pytest_cover.py index 61c8ba13..3e18f875 100644 --- a/tests/test_pytest_cover.py +++ b/tests/test_pytest_cover.py @@ -1,11 +1,10 @@ import os import sys +import subprocess import virtualenv - import py import pytest -import subprocess import pytest_cover.plugin pytest_plugins = 'pytester', 'cov' @@ -188,6 +187,34 @@ def test_central_coveragerc(testdir): assert result.ret == 0 +def test_show_missing_coveragerc(testdir): + script = testdir.makepyfile(SCRIPT) + testdir.tmpdir.join('.coveragerc').write(""" +[run] +source = . + +[report] +show_missing = true +""") + + result = testdir.runpytest('-v', + '--cov', + '--cov-report=term', + script) + + result.stdout.fnmatch_lines([ + '*- coverage: platform *, python * -*', + 'Name * Stmts * Miss * Cover * Missing', + 'test_show_missing_coveragerc* %s * 11' % SCRIPT_RESULT, + '*10 passed*', + ]) + + # single-module coverage report + assert result.stdout.lines[-3].startswith('test_show_missing_coveragerc') + + assert result.ret == 0 + + def test_no_cov_on_fail(testdir): script = testdir.makepyfile(SCRIPT_FAIL) From 9841727b211609c46467eb44b31a0ca1c3636edd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sun, 28 Jun 2015 19:57:48 +0300 Subject: [PATCH 33/47] If `term-missing` is not specified then use `None` instead of `False` for `show_missing` option. This allows the `show_missing` specified in .coveragerc to be used. Ref #1. --- src/pytest_cover/engine.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pytest_cover/engine.py b/src/pytest_cover/engine.py index b2121c08..4c867cd9 100644 --- a/src/pytest_cover/engine.py +++ b/src/pytest_cover/engine.py @@ -72,7 +72,7 @@ def summary(self, stream): # Produce terminal report if wanted. if 'term' in self.cov_report or 'term-missing' in self.cov_report: - show_missing = 'term-missing' in self.cov_report + show_missing = ('term-missing' in self.cov_report) or None total = self.cov.report(show_missing=show_missing, ignore_errors=True, file=stream) # Produce annotated source code report if wanted. From 97e4b22d6f1ca74ecc911119c6770c2e47170205 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sun, 28 Jun 2015 22:36:34 +0300 Subject: [PATCH 34/47] Load default cov_min from `[report]fail_under` (if coverage is 4.0). Ref #2. --- src/pytest_cover/plugin.py | 3 +++ tests/test_pytest_cover.py | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/pytest_cover/plugin.py b/src/pytest_cover/plugin.py index 7ce61037..11d720fe 100644 --- a/src/pytest_cover/plugin.py +++ b/src/pytest_cover/plugin.py @@ -113,6 +113,9 @@ class Config(object): nodeid ) self.cov_controller.start() + cov_config = self.cov_controller.cov.config + if self.options.cov_min is None and hasattr(cov_config, 'fail_under'): + self.options.cov_min = cov_config.fail_under def pytest_sessionstart(self, session): """At session start determine our implementation and delegate to it.""" diff --git a/tests/test_pytest_cover.py b/tests/test_pytest_cover.py index 3e18f875..d397b7c5 100644 --- a/tests/test_pytest_cover.py +++ b/tests/test_pytest_cover.py @@ -1,7 +1,9 @@ +from distutils.version import StrictVersion import os import sys import subprocess +import coverage import virtualenv import py import pytest @@ -166,6 +168,22 @@ def test_central_nonspecific(testdir): assert result.ret == 0 +@pytest.mark.skipif('StrictVersion(coverage.__version__) <= StrictVersion("3.8")') +def test_cov_min_from_coveragerc(testdir): + script = testdir.makepyfile(SCRIPT) + testdir.tmpdir.join('.coveragerc').write(""" +[report] +fail_under = 100 +""") + + result = testdir.runpytest('-v', + '--cov=%s' % script.dirpath(), + '--cov-report=term-missing', + script) + + assert result.ret == 1 + + def test_central_coveragerc(testdir): script = testdir.makepyfile(SCRIPT) testdir.tmpdir.join('.coveragerc').write(COVERAGERC_SOURCE) From 10a54f17c4435cd8ce5eabf44ecbec8d020708c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sun, 28 Jun 2015 22:51:05 +0300 Subject: [PATCH 35/47] Rename --cov-min to --cov-fail-under. --- src/pytest_cover/plugin.py | 2 +- tests/test_pytest_cover.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pytest_cover/plugin.py b/src/pytest_cover/plugin.py index 11d720fe..1febf0f1 100644 --- a/src/pytest_cover/plugin.py +++ b/src/pytest_cover/plugin.py @@ -33,7 +33,7 @@ def pytest_addoption(parser): dest='no_cov_on_fail', help='do not report coverage if test run fails, ' 'default: False') - group.addoption('--cov-min', action='store', metavar='MIN', type='int', + group.addoption('--cov-fail-under', action='store', metavar='MIN', type='int', help='Fail if the total coverage is less than MIN.') diff --git a/tests/test_pytest_cover.py b/tests/test_pytest_cover.py index d397b7c5..87ddcbe5 100644 --- a/tests/test_pytest_cover.py +++ b/tests/test_pytest_cover.py @@ -118,7 +118,7 @@ def test_cov_min_100(testdir): result = testdir.runpytest('-v', '--cov=%s' % script.dirpath(), '--cov-report=term-missing', - '--cov-min=100', + '--cov-fail-under=100', script) assert result.ret == 1 @@ -130,7 +130,7 @@ def test_cov_min_50(testdir): result = testdir.runpytest('-v', '--cov=%s' % script.dirpath(), '--cov-report=term-missing', - '--cov-min=50', + '--cov-fail-under=50', script) assert result.ret == 0 @@ -142,7 +142,7 @@ def test_cov_min_no_report(testdir): result = testdir.runpytest('-v', '--cov=%s' % script.dirpath(), '--cov-report=', - '--cov-min=50', + '--cov-fail-under=50', script) assert result.ret == 0 From 90a6e35f11512b376992709516ee2494aa286ee4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sun, 28 Jun 2015 22:52:15 +0300 Subject: [PATCH 36/47] Update changelog. Closes #1. Closes #2. --- CHANGELOG.rst | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index edea7f86..2d3ba20c 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,14 @@ Changelog ========= +2.0.0 (??????????) +------------------ + +* Renamed ``--cov-min`` to ``--cov-fail-under`` to be consistent with the new ``fail_under`` option in `coverage-4.0`. +* Changed ``--cov-report=term`` to automatically upgrade to ``--cov-report=term-missing`` if there's ``[run] show_missing = True`` in + ``.coveragerc``. +* Changed ``--cov-fail-under`` to be automatically activated if there's a ``[report] fail_under =`` in ``.coveragerc``. + 1.0.0 (2015-06-05) ------------------ @@ -13,7 +21,7 @@ Changelog * Forked from the `2.0` branch of https://github.com/schlamar/pytest-cov/ - fixes include: - * No need to specify the source anymore via ``--cov``. The source settings from + * No need to specify the source anymore via ``--cov``. The source settings from ``.coveragerc`` will be used instead. * Support for ``--cov-min``. From cbebaa356c4d3bb59387a76308bd417cc45df7c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sun, 28 Jun 2015 23:01:13 +0300 Subject: [PATCH 37/47] Update skel a bit. --- .gitignore | 2 ++ MANIFEST.in | 2 +- README.rst | 36 +++++++++++++++++++++++++----------- docs/conf.py | 15 +++++++-------- setup.cfg | 5 ++++- 5 files changed, 39 insertions(+), 21 deletions(-) diff --git a/.gitignore b/.gitignore index 8365f940..01f10962 100644 --- a/.gitignore +++ b/.gitignore @@ -54,5 +54,7 @@ docs/_build .build .ve .env +.cache +.pytest .bootstrap *.bak diff --git a/MANIFEST.in b/MANIFEST.in index 69475e23..e64932b8 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -4,9 +4,9 @@ graft src graft ci graft tests -include *.komodoproject include .bumpversion.cfg include .coveragerc +include .cookiecutterrc include .isort.cfg include .pylintrc diff --git a/README.rst b/README.rst index 8de31d54..7e10ac9d 100644 --- a/README.rst +++ b/README.rst @@ -2,50 +2,64 @@ pytest-cover =============================== -| |docs| |travis| |appveyor| -| |version| |downloads| |wheel| |supported-versions| |supported-implementations| +.. list-table:: + :stub-columns: 1 + + * - docs + - |docs| + * - tests + - | |travis| |appveyor| + * - package + - |version| |downloads| + +.. + |wheel| |supported-versions| |supported-implementations| .. |docs| image:: https://readthedocs.org/projects/pytest-cover/badge/?style=flat :target: https://readthedocs.org/projects/pytest-cover :alt: Documentation Status -.. |travis| image:: http://img.shields.io/travis/ionelmc/pytest-cover/master.png?style=flat +.. |travis| image:: http://img.shields.io/travis/ionelmc/pytest-cover/master.svg?style=flat&label=Travis :alt: Travis-CI Build Status :target: https://travis-ci.org/ionelmc/pytest-cover -.. |appveyor| image:: https://ci.appveyor.com/api/projects/status/github/ionelmc/pytest-cover?branch=master +.. |appveyor| image:: https://img.shields.io/appveyor/ci/ionelmc/pytest-cover/master.svg?style=flat&label=AppVeyor :alt: AppVeyor Build Status :target: https://ci.appveyor.com/project/ionelmc/pytest-cover -.. |coveralls| image:: http://img.shields.io/coveralls/ionelmc/pytest-cover/master.png?style=flat +.. |coveralls| image:: http://img.shields.io/coveralls/ionelmc/pytest-cover/master.svg?style=flat&label=Coveralls :alt: Coverage Status :target: https://coveralls.io/r/ionelmc/pytest-cover +.. |codecov| image:: http://img.shields.io/codecov/c/github/ionelmc/pytest-cover/master.svg?style=flat&label=Codecov + :alt: Coverage Status + :target: https://codecov.io/github/ionelmc/pytest-cover + .. |landscape| image:: https://landscape.io/github/ionelmc/pytest-cover/master/landscape.svg?style=flat :target: https://landscape.io/github/ionelmc/pytest-cover/master :alt: Code Quality Status -.. |version| image:: http://img.shields.io/pypi/v/pytest-cover.png?style=flat +.. |version| image:: http://img.shields.io/pypi/v/pytest-cover.svg?style=flat :alt: PyPI Package latest release :target: https://pypi.python.org/pypi/pytest-cover -.. |downloads| image:: http://img.shields.io/pypi/dm/pytest-cover.png?style=flat +.. |downloads| image:: http://img.shields.io/pypi/dm/pytest-cover.svg?style=flat :alt: PyPI Package monthly downloads :target: https://pypi.python.org/pypi/pytest-cover -.. |wheel| image:: https://pypip.in/wheel/pytest-cover/badge.png?style=flat +.. |wheel| image:: https://pypip.in/wheel/pytest-cover/badge.svg?style=flat :alt: PyPI Wheel :target: https://pypi.python.org/pypi/pytest-cover -.. |supported-versions| image:: https://pypip.in/py_versions/pytest-cover/badge.png?style=flat +.. |supported-versions| image:: https://pypip.in/py_versions/pytest-cover/badge.svg?style=flat :alt: Supported versions :target: https://pypi.python.org/pypi/pytest-cover -.. |supported-implementations| image:: https://pypip.in/implementation/pytest-cover/badge.png?style=flat +.. |supported-implementations| image:: https://pypip.in/implementation/pytest-cover/badge.svg?style=flat :alt: Supported imlementations :target: https://pypi.python.org/pypi/pytest-cover -.. |scrutinizer| image:: https://img.shields.io/scrutinizer/g/ionelmc/pytest-cover/master.png?style=flat +.. |scrutinizer| image:: https://img.shields.io/scrutinizer/g/ionelmc/pytest-cover/master.svg?style=flat :alt: Scrutinizer Status :target: https://scrutinizer-ci.com/g/ionelmc/pytest-cover/ diff --git a/docs/conf.py b/docs/conf.py index 42fc5872..65c15d84 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -20,15 +20,17 @@ source_suffix = '.rst' master_doc = 'index' -project = u'pytest-cover' -year = u'2015' -author = u'Ionel Cristian M\u0103rie\u0219' +project = 'pytest-cover' +year = '2015' +author = 'Ionel Cristian Mărieș' copyright = '{0}, {1}'.format(year, author) -version = release = u'0.1.0' - +version = release = '1.0.0' import sphinx_py3doc_enhanced_theme html_theme = "sphinx_py3doc_enhanced_theme" html_theme_path = [sphinx_py3doc_enhanced_theme.get_html_theme_path()] +html_theme_options = { + 'githuburl': 'https://github.com/ionelmc/pytest-cover/' +} pygments_style = 'trac' templates_path = ['.'] @@ -39,6 +41,3 @@ '**': ['searchbox.html', 'globaltoc.html', 'sourcelink.html'], } html_short_title = '%s-%s' % (project, version) -html_theme_options = { - 'githuburl': 'https://github.com/ionelmc/pytest-cover/' -} diff --git a/setup.cfg b/setup.cfg index e7e42f25..b41424e7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -10,10 +10,13 @@ exclude = tests/*,*/migrations/*,*/south_migrations/* [bumpversion] current_version = 0.1.0 -files = setup.py docs/conf.py src/pytest_cover/__init__.py commit = True tag = True +[bumpversion:file:setup.py] +[bumpversion:file:docs/conf.py] +[bumpversion:file:src/pytest_cover/__init__.py] + [pytest] norecursedirs = .git From 076045f12a1419078cda886df3a57297c2fe2174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sun, 28 Jun 2015 23:04:31 +0300 Subject: [PATCH 38/47] Fix incorrect renaming. --- src/pytest_cover/plugin.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pytest_cover/plugin.py b/src/pytest_cover/plugin.py index 1febf0f1..7abb0bef 100644 --- a/src/pytest_cover/plugin.py +++ b/src/pytest_cover/plugin.py @@ -114,8 +114,8 @@ class Config(object): ) self.cov_controller.start() cov_config = self.cov_controller.cov.config - if self.options.cov_min is None and hasattr(cov_config, 'fail_under'): - self.options.cov_min = cov_config.fail_under + if self.options.cov_fail_under is None and hasattr(cov_config, 'fail_under'): + self.options.cov_fail_under = cov_config.fail_under def pytest_sessionstart(self, session): """At session start determine our implementation and delegate to it.""" @@ -155,11 +155,11 @@ def pytest_terminal_summary(self, terminalreporter): if not (self.failed and self.options.no_cov_on_fail): total = self.cov_controller.summary(terminalreporter.writer) assert total is not None, 'Test coverage should never be `None`' - cov_min = self.options.cov_min - if cov_min is not None and total < cov_min: + cov_fail_under = self.options.cov_fail_under + if cov_fail_under is not None and total < cov_fail_under: raise CoverageError(('Required test coverage of %d%% not ' 'reached. Total coverage: %.2f%%') - % (self.options.cov_min, total)) + % (self.options.cov_fail_under, total)) def pytest_runtest_setup(self, item): if os.getpid() != self.pid: From 781a9e936ced449dd99e228ab7902c41da0e5f07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Mon, 29 Jun 2015 11:22:31 +0300 Subject: [PATCH 39/47] Update changelog. --- CHANGELOG.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2d3ba20c..f20df406 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,13 +1,13 @@ Changelog ========= -2.0.0 (??????????) +2.0.0 (2015-06-29) ------------------ * Renamed ``--cov-min`` to ``--cov-fail-under`` to be consistent with the new ``fail_under`` option in `coverage-4.0`. * Changed ``--cov-report=term`` to automatically upgrade to ``--cov-report=term-missing`` if there's ``[run] show_missing = True`` in ``.coveragerc``. -* Changed ``--cov-fail-under`` to be automatically activated if there's a ``[report] fail_under =`` in ``.coveragerc``. +* Changed ``--cov-fail-under`` to be automatically activated if there's a ``[report] fail_under = ...`` in ``.coveragerc``. 1.0.0 (2015-06-05) ------------------ From c25b99645df7ee04e1c0f731ccf5ba24f9b97915 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Mon, 29 Jun 2015 11:27:14 +0300 Subject: [PATCH 40/47] Unicodes --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index dfb52a5d..fa8828e7 100644 --- a/setup.py +++ b/setup.py @@ -88,7 +88,7 @@ def run(self): long_description='%s\n%s' % (read('README.rst'), re.sub(':[a-z]+:`~?(.*?)`', r'``\1``', read('CHANGELOG.rst'))), author='Marc Schlaich', author_email='marc.schlaich@gmail.com', - maintainer='Ionel Cristian M\u0103rie\u0219', + maintainer='Ionel Cristian Mărieș', maintainer_email='contact@ionelmc.ro', url='https://github.com/ionelmc/pytest-cover', packages=find_packages('src'), From 2cfebe5aca4066282287911e89ca61292ab8433e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Mon, 29 Jun 2015 11:39:01 +0300 Subject: [PATCH 41/47] Fix version. --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index b41424e7..173b20ae 100644 --- a/setup.cfg +++ b/setup.cfg @@ -9,7 +9,7 @@ max-line-length = 140 exclude = tests/*,*/migrations/*,*/south_migrations/* [bumpversion] -current_version = 0.1.0 +current_version = 1.0.0 commit = True tag = True From 3439cf4e899f97be536844722b0cb3e3b9059b6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Mon, 29 Jun 2015 11:39:03 +0300 Subject: [PATCH 42/47] =?UTF-8?q?Bump=20version:=201.0.0=20=E2=86=92=202.0?= =?UTF-8?q?.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/conf.py | 2 +- setup.cfg | 119 ++++++++++++++--------------------- setup.py | 2 +- src/pytest_cover/__init__.py | 2 +- 4 files changed, 50 insertions(+), 75 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 65c15d84..1eca1fc7 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -24,7 +24,7 @@ year = '2015' author = 'Ionel Cristian Mărieș' copyright = '{0}, {1}'.format(year, author) -version = release = '1.0.0' +version = release = '2.0.0' import sphinx_py3doc_enhanced_theme html_theme = "sphinx_py3doc_enhanced_theme" html_theme_path = [sphinx_py3doc_enhanced_theme.get_html_theme_path()] diff --git a/setup.cfg b/setup.cfg index 173b20ae..a30ce397 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,8 @@ +[bumpversion] +current_version = 2.0.0 +commit = True +tag = True + [bdist_wheel] universal = 1 @@ -8,85 +13,55 @@ release = register clean --all sdist bdist_wheel max-line-length = 140 exclude = tests/*,*/migrations/*,*/south_migrations/* -[bumpversion] -current_version = 1.0.0 -commit = True -tag = True - [bumpversion:file:setup.py] + [bumpversion:file:docs/conf.py] + [bumpversion:file:src/pytest_cover/__init__.py] [pytest] -norecursedirs = - .git - .tox - .env - dist - build - south_migrations - migrations - example -python_files = - test_*.py - *_test.py - tests.py -addopts = - -rxEfs - --strict - --ignore=docs/conf.py - --ignore=setup.py - --ignore=src - --ignore=ci - --doctest-modules - --doctest-glob=\*.rst - --tb=short +norecursedirs = + .git + .tox + .env + dist + build + south_migrations + migrations + example +python_files = + test_*.py + *_test.py + tests.py +addopts = + -rxEfs + --strict + --ignore=docs/conf.py + --ignore=setup.py + --ignore=src + --ignore=ci + --doctest-modules + --doctest-glob=\*.rst + --tb=short [isort] -force_single_line=True -line_length=120 -known_first_party=pytest_cover -default_section=THIRDPARTY -forced_separate=test_pytest_cover +force_single_line = True +line_length = 120 +known_first_party = pytest_cover +default_section = THIRDPARTY +forced_separate = test_pytest_cover [matrix] -# This is the configuration for the `./bootstrap.py` script. -# It generates `.travis.yml`, `tox.ini` and `appveyor.yml`. -# -# Syntax: [alias:] value [!variable[glob]] [&variable[glob]] -# -# alias: -# - is used to generate the tox environment -# - it's optional -# - if not present the alias will be computed from the `value` -# value: -# - a value of "-" means empty -# !variable[glob]: -# - exclude the combination of the current `value` with -# any value matching the `glob` in `variable` -# - can use as many you want -# &variable[glob]: -# - only include the combination of the current `value` -# when there's a value matching `glob` in `variable` -# - can use as many you want - -python_versions = - 2.6 - 2.7 - 3.3 - 3.4 - pypy - -dependencies = -# 1.4: Django==1.4.16 !python_versions[3.*] -# 1.5: Django==1.5.11 -# 1.6: Django==1.6.8 -# 1.7: Django==1.7.1 !python_versions[2.6] -# Deps commented above are provided as examples. That's what you would use in a Django project. - -coverage_flags = - : true - nocover: false +python_versions = + 2.6 + 2.7 + 3.3 + 3.4 + pypy +dependencies = +coverage_flags = + : true + nocover: false +environment_variables = + - -environment_variables = - - diff --git a/setup.py b/setup.py index fa8828e7..33002e24 100644 --- a/setup.py +++ b/setup.py @@ -82,7 +82,7 @@ def run(self): setup( name='pytest-cover', - version='1.0.0', + version='2.0.0', license='MIT', description='Pytest plugin for measuring coverage. Forked from `pytest-cov`.', long_description='%s\n%s' % (read('README.rst'), re.sub(':[a-z]+:`~?(.*?)`', r'``\1``', read('CHANGELOG.rst'))), diff --git a/src/pytest_cover/__init__.py b/src/pytest_cover/__init__.py index 5becc17c..8c0d5d5b 100644 --- a/src/pytest_cover/__init__.py +++ b/src/pytest_cover/__init__.py @@ -1 +1 @@ -__version__ = "1.0.0" +__version__ = "2.0.0" From c1f29b5192647800af174a5bf8219214fafcacb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Tue, 30 Jun 2015 20:37:14 +0300 Subject: [PATCH 43/47] Unfork project (rename back to pytest-cov). --- CHANGELOG.rst | 28 +++---- CONTRIBUTING.rst | 26 +++---- LICENSE | 29 +++++--- README.rst | 77 +++++++++++--------- docs/conf.py | 4 +- docs/index.rst | 2 +- docs/installation.rst | 2 +- docs/reference/index.rst | 2 +- docs/reference/pytest_cover.rst | 4 +- docs/usage.rst | 4 +- setup.cfg | 18 ++--- setup.py | 22 +++--- src/{pytest-cover.embed => pytest-cov.embed} | 2 +- src/pytest-cov.pth | 1 + src/pytest-cover.pth | 1 - src/{pytest_cover => pytest_cov}/__init__.py | 0 src/{pytest_cover => pytest_cov}/embed.py | 0 src/{pytest_cover => pytest_cov}/engine.py | 0 src/{pytest_cover => pytest_cov}/plugin.py | 0 tests/test_pytest_cover.py | 4 +- 20 files changed, 116 insertions(+), 110 deletions(-) rename src/{pytest-cover.embed => pytest-cov.embed} (87%) create mode 100644 src/pytest-cov.pth delete mode 100644 src/pytest-cover.pth rename src/{pytest_cover => pytest_cov}/__init__.py (100%) rename src/{pytest_cover => pytest_cov}/embed.py (100%) rename src/{pytest_cover => pytest_cov}/engine.py (100%) rename src/{pytest_cover => pytest_cov}/plugin.py (100%) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index f20df406..dc22f299 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,26 +4,16 @@ Changelog 2.0.0 (2015-06-29) ------------------ -* Renamed ``--cov-min`` to ``--cov-fail-under`` to be consistent with the new ``fail_under`` option in `coverage-4.0`. -* Changed ``--cov-report=term`` to automatically upgrade to ``--cov-report=term-missing`` if there's ``[run] show_missing = True`` in - ``.coveragerc``. -* Changed ``--cov-fail-under`` to be automatically activated if there's a ``[report] fail_under = ...`` in ``.coveragerc``. - -1.0.0 (2015-06-05) ------------------- - +* Added ``--cov-fail-under``, akin to the new ``fail_under`` option in `coverage-4.0` + (automatically activated if there's a ``[report] fail_under = ...`` in ``.coveragerc``). +* Changed ``--cov-report=term`` to automatically upgrade to ``--cov-report=term-missing`` + if there's ``[run] show_missing = True`` in ``.coveragerc``. +* Changed ``--cov`` so it can be used with no path argument (in wich case the source + settings from ``.coveragerc`` will be used instead). * Fixed `.pth` installation to work in all cases (install, easy_install, wheels, develop etc). * Fixed `.pth` uninstallation to work for wheel installs. -* Reverted the unreleased ``--cov=path`` deprecation. -* Removed the unreleased addition of ``--cov-source=path``. - ------ - -* Forked from the `2.0` branch of https://github.com/schlamar/pytest-cov/ - fixes include: - - * No need to specify the source anymore via ``--cov``. The source settings from - ``.coveragerc`` will be used instead. - * Support for ``--cov-min``. - +1.8.2 (2014-11-06) +------------------ +* N/A diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 10586f82..91573192 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -8,7 +8,7 @@ little bit helps, and credit will always be given. Bug reports =========== -When `reporting a bug `_ please include: +When `reporting a bug `_ please include: * Your operating system name and version. * Any details about your local setup that might be helpful in troubleshooting. @@ -17,14 +17,14 @@ When `reporting a bug `_ please Documentation improvements ========================== -pytest-cover could always use more documentation, whether as part of the -official pytest-cover docs, in docstrings, or even on the web in blog posts, +pytest-cov could always use more documentation, whether as part of the +official pytest-cov docs, in docstrings, or even on the web in blog posts, articles, and such. Feature requests and feedback ============================= -The best way to send feedback is to file an issue at https://github.com/ionelmc/pytest-cover/issues. +The best way to send feedback is to file an issue at https://github.com/schlamar/pytest-cov/issues. If you are proposing a feature: @@ -35,12 +35,12 @@ If you are proposing a feature: Development =========== -To set up `pytest-cover` for local development: +To set up `pytest-cov` for local development: -1. `Fork pytest-cover on GitHub `_. +1. `Fork pytest-cov on GitHub `_. 2. Clone your fork locally:: - git clone git@github.com:your_name_here/pytest-cover.git + git clone git@github.com:your_name_here/pytest-cov.git 3. Create a branch for local development:: @@ -68,15 +68,15 @@ If you need some code review or feedback while you're developing the code just m For merging, you should: 1. Include passing tests (run ``tox``) [1]_. -2. Update documentation when there's new API, functionality etc. +2. Update documentation when there's new API, functionality etc. 3. Add a note to ``CHANGELOG.rst`` about the changes. 4. Add yourself to ``AUTHORS.rst``. -.. [1] If you don't have all the necessary python versions available locally you can rely on Travis - it will - `run the tests `_ for each change you add in the pull request. - +.. [1] If you don't have all the necessary python versions available locally you can rely on Travis - it will + `run the tests `_ for each change you add in the pull request. + It will be slower though ... - + Tips ---- @@ -86,4 +86,4 @@ To run a subset of tests:: To run all the test environments in *parallel* (you need to ``pip install detox``):: - detox \ No newline at end of file + detox diff --git a/LICENSE b/LICENSE index e98b6474..5b3634b4 100644 --- a/LICENSE +++ b/LICENSE @@ -1,14 +1,21 @@ -Copyright (c) 2015, Ionel Cristian Mărieș +The MIT License -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: +Copyright (c) 2010 Meme Dough -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the -Software. +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 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. \ No newline at end of file +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. diff --git a/README.rst b/README.rst index 7e10ac9d..4e277f4f 100644 --- a/README.rst +++ b/README.rst @@ -1,5 +1,5 @@ =============================== -pytest-cover +pytest-cov =============================== .. list-table:: @@ -15,62 +15,62 @@ pytest-cover .. |wheel| |supported-versions| |supported-implementations| -.. |docs| image:: https://readthedocs.org/projects/pytest-cover/badge/?style=flat - :target: https://readthedocs.org/projects/pytest-cover +.. |docs| image:: https://readthedocs.org/projects/pytest-cov/badge/?style=flat + :target: https://readthedocs.org/projects/pytest-cov :alt: Documentation Status -.. |travis| image:: http://img.shields.io/travis/ionelmc/pytest-cover/master.svg?style=flat&label=Travis +.. |travis| image:: http://img.shields.io/travis/schlamar/pytest-cov/master.svg?style=flat&label=Travis :alt: Travis-CI Build Status - :target: https://travis-ci.org/ionelmc/pytest-cover + :target: https://travis-ci.org/schlamar/pytest-cov -.. |appveyor| image:: https://img.shields.io/appveyor/ci/ionelmc/pytest-cover/master.svg?style=flat&label=AppVeyor +.. |appveyor| image:: https://img.shields.io/appveyor/ci/schlamar/pytest-cov/master.svg?style=flat&label=AppVeyor :alt: AppVeyor Build Status - :target: https://ci.appveyor.com/project/ionelmc/pytest-cover + :target: https://ci.appveyor.com/project/schlamar/pytest-cov -.. |coveralls| image:: http://img.shields.io/coveralls/ionelmc/pytest-cover/master.svg?style=flat&label=Coveralls +.. |coveralls| image:: http://img.shields.io/coveralls/schlamar/pytest-cov/master.svg?style=flat&label=Coveralls :alt: Coverage Status - :target: https://coveralls.io/r/ionelmc/pytest-cover + :target: https://coveralls.io/r/schlamar/pytest-cov -.. |codecov| image:: http://img.shields.io/codecov/c/github/ionelmc/pytest-cover/master.svg?style=flat&label=Codecov +.. |codecov| image:: http://img.shields.io/codecov/c/github/schlamar/pytest-cov/master.svg?style=flat&label=Codecov :alt: Coverage Status - :target: https://codecov.io/github/ionelmc/pytest-cover + :target: https://codecov.io/github/schlamar/pytest-cov -.. |landscape| image:: https://landscape.io/github/ionelmc/pytest-cover/master/landscape.svg?style=flat - :target: https://landscape.io/github/ionelmc/pytest-cover/master +.. |landscape| image:: https://landscape.io/github/schlamar/pytest-cov/master/landscape.svg?style=flat + :target: https://landscape.io/github/schlamar/pytest-cov/master :alt: Code Quality Status -.. |version| image:: http://img.shields.io/pypi/v/pytest-cover.svg?style=flat +.. |version| image:: http://img.shields.io/pypi/v/pytest-cov.svg?style=flat :alt: PyPI Package latest release - :target: https://pypi.python.org/pypi/pytest-cover + :target: https://pypi.python.org/pypi/pytest-cov -.. |downloads| image:: http://img.shields.io/pypi/dm/pytest-cover.svg?style=flat +.. |downloads| image:: http://img.shields.io/pypi/dm/pytest-cov.svg?style=flat :alt: PyPI Package monthly downloads - :target: https://pypi.python.org/pypi/pytest-cover + :target: https://pypi.python.org/pypi/pytest-cov -.. |wheel| image:: https://pypip.in/wheel/pytest-cover/badge.svg?style=flat +.. |wheel| image:: https://pypip.in/wheel/pytest-cov/badge.svg?style=flat :alt: PyPI Wheel - :target: https://pypi.python.org/pypi/pytest-cover + :target: https://pypi.python.org/pypi/pytest-cov -.. |supported-versions| image:: https://pypip.in/py_versions/pytest-cover/badge.svg?style=flat +.. |supported-versions| image:: https://pypip.in/py_versions/pytest-cov/badge.svg?style=flat :alt: Supported versions - :target: https://pypi.python.org/pypi/pytest-cover + :target: https://pypi.python.org/pypi/pytest-cov -.. |supported-implementations| image:: https://pypip.in/implementation/pytest-cover/badge.svg?style=flat +.. |supported-implementations| image:: https://pypip.in/implementation/pytest-cov/badge.svg?style=flat :alt: Supported imlementations - :target: https://pypi.python.org/pypi/pytest-cover + :target: https://pypi.python.org/pypi/pytest-cov -.. |scrutinizer| image:: https://img.shields.io/scrutinizer/g/ionelmc/pytest-cover/master.svg?style=flat +.. |scrutinizer| image:: https://img.shields.io/scrutinizer/g/schlamar/pytest-cov/master.svg?style=flat :alt: Scrutinizer Status - :target: https://scrutinizer-ci.com/g/ionelmc/pytest-cover/ + :target: https://scrutinizer-ci.com/g/schlamar/pytest-cov/ -Pytest plugin for measuring coverage. Forked from `pytest-cov `_. +Pytest plugin for measuring coverage. * Free software: MIT license This plugin produces coverage reports. It supports centralised testing and distributed testing in both load and each modes. It also supports coverage of subprocesses. -All features offered by the coverage package should be available, either through pytest-cover or +All features offered by the coverage package should be available, either through pytest-cov or through coverage's config file. @@ -79,7 +79,7 @@ Installation Install with pip:: - pip install pytest-cover + pip install pytest-cov For distributed testing support install pytest-xdist:: @@ -96,7 +96,7 @@ Uninstallation Uninstall with pip:: - pip uninstall pytest-cover + pip uninstall pytest-cov Usage ===== @@ -284,17 +284,28 @@ effect. These include specifying source to be measured (source option) and all Limitations =========== -For distributed testing the slaves must have the pytest-cover package installed. This is needed since +For distributed testing the slaves must have the pytest-cov package installed. This is needed since the plugin must be registered through setuptools for pytest to start the plugin on the slave. For subprocess measurement environment variables must make it from the main process to the -subprocess. The python used by the subprocess must have pytest-cover installed. The subprocess must +subprocess. The python used by the subprocess must have pytest-cov installed. The subprocess must do normal site initialisation so that the environment variables can be detected and coverage started. Acknowledgements ================ -`Marc Schlaich` and everyone else for contributing and creating `pytest-cov (and cov-core) `_. -This plugin is a merge of those two packages with other fixes. +Whilst this plugin has been built fresh from the ground up it has been influenced by the work done +on pytest-coverage (Ross Lawley, James Mills, Holger Krekel) and nose-cover (Jason Pellerin) which are +other coverage plugins. + +Ned Batchelder for coverage and its ability to combine the coverage results of parallel runs. + +Holger Krekel for pytest with its distributed testing support. + +Jason Pellerin for nose. + +Michael Foord for unittest2. + +No doubt others have contributed to these tools as well. diff --git a/docs/conf.py b/docs/conf.py index 1eca1fc7..d48985a3 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -20,7 +20,7 @@ source_suffix = '.rst' master_doc = 'index' -project = 'pytest-cover' +project = 'pytest-cov' year = '2015' author = 'Ionel Cristian Mărieș' copyright = '{0}, {1}'.format(year, author) @@ -29,7 +29,7 @@ html_theme = "sphinx_py3doc_enhanced_theme" html_theme_path = [sphinx_py3doc_enhanced_theme.get_html_theme_path()] html_theme_options = { - 'githuburl': 'https://github.com/ionelmc/pytest-cover/' + 'githuburl': 'https://github.com/schlamar/pytest-cov/' } pygments_style = 'trac' diff --git a/docs/index.rst b/docs/index.rst index be946912..1d1c58c1 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,4 +1,4 @@ -Welcome to pytest-cover's documentation! +Welcome to pytest-cov's documentation! ====================================== Contents: diff --git a/docs/installation.rst b/docs/installation.rst index 76e143b2..d12d3475 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -4,4 +4,4 @@ Installation At the command line:: - pip install pytest-cover + pip install pytest-cov diff --git a/docs/reference/index.rst b/docs/reference/index.rst index 8cb90cb5..5fd2c7f9 100644 --- a/docs/reference/index.rst +++ b/docs/reference/index.rst @@ -4,4 +4,4 @@ Reference .. toctree:: :glob: - pytest_cover* + pytest_cov* diff --git a/docs/reference/pytest_cover.rst b/docs/reference/pytest_cover.rst index a3695344..caf88b39 100644 --- a/docs/reference/pytest_cover.rst +++ b/docs/reference/pytest_cover.rst @@ -1,5 +1,5 @@ -pytest_cover +pytest_cov ============================= -.. automodule:: pytest_cover +.. automodule:: pytest_cov :members: diff --git a/docs/usage.rst b/docs/usage.rst index 36872c2d..89b4912e 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -2,6 +2,6 @@ Usage ===== -To use pytest-cover in a project:: +To use pytest-cov in a project:: - import pytest_cover + import pytest_cov diff --git a/setup.cfg b/setup.cfg index a30ce397..89d17ff1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -17,10 +17,10 @@ exclude = tests/*,*/migrations/*,*/south_migrations/* [bumpversion:file:docs/conf.py] -[bumpversion:file:src/pytest_cover/__init__.py] +[bumpversion:file:src/pytest_cov/__init__.py] [pytest] -norecursedirs = +norecursedirs = .git .tox .env @@ -29,11 +29,11 @@ norecursedirs = south_migrations migrations example -python_files = +python_files = test_*.py *_test.py tests.py -addopts = +addopts = -rxEfs --strict --ignore=docs/conf.py @@ -47,21 +47,21 @@ addopts = [isort] force_single_line = True line_length = 120 -known_first_party = pytest_cover +known_first_party = pytest_cov default_section = THIRDPARTY forced_separate = test_pytest_cover [matrix] -python_versions = +python_versions = 2.6 2.7 3.3 3.4 pypy -dependencies = -coverage_flags = +dependencies = +coverage_flags = : true nocover: false -environment_variables = +environment_variables = - diff --git a/setup.py b/setup.py index 33002e24..adb70197 100644 --- a/setup.py +++ b/setup.py @@ -30,7 +30,7 @@ def read(*names, **kwargs): class BuildWithPTH(build): def run(self): build.run(self) - path = join(dirname(__file__), 'src', 'pytest-cover.pth') + path = join(dirname(__file__), 'src', 'pytest-cov.pth') dest = join(self.build_lib, basename(path)) self.copy_file(path, dest) @@ -38,7 +38,7 @@ def run(self): class EasyInstallWithPTH(easy_install): def run(self): easy_install.run(self) - path = join(dirname(__file__), 'src', 'pytest-cover.pth') + path = join(dirname(__file__), 'src', 'pytest-cov.pth') dest = join(self.install_dir, basename(path)) self.copy_file(path, dest) @@ -46,7 +46,7 @@ def run(self): class InstallLibWithPTH(install_lib): def run(self): install_lib.run(self) - path = join(dirname(__file__), 'src', 'pytest-cover.pth') + path = join(dirname(__file__), 'src', 'pytest-cov.pth') dest = join(self.install_dir, basename(path)) self.copy_file(path, dest) self.outputs = [dest] @@ -58,7 +58,7 @@ def get_outputs(self): class DevelopWithPTH(develop): def run(self): develop.run(self) - path = join(dirname(__file__), 'src', 'pytest-cover.pth') + path = join(dirname(__file__), 'src', 'pytest-cov.pth') dest = join(self.install_dir, basename(path)) self.copy_file(path, dest) @@ -73,24 +73,22 @@ def finalize_options(self): pass def run(self): - with open(join(dirname(__file__), 'src', 'pytest-cover.pth'), 'w') as fh: - with open(join(dirname(__file__), 'src', 'pytest-cover.embed')) as sh: + with open(join(dirname(__file__), 'src', 'pytest-cov.pth'), 'w') as fh: + with open(join(dirname(__file__), 'src', 'pytest-cov.embed')) as sh: fh.write( 'import os, sys;' 'exec(%r)' % sh.read().replace(' ', ' ') ) setup( - name='pytest-cover', + name='pytest-cov', version='2.0.0', license='MIT', - description='Pytest plugin for measuring coverage. Forked from `pytest-cov`.', + description='Pytest plugin for measuring coverage.', long_description='%s\n%s' % (read('README.rst'), re.sub(':[a-z]+:`~?(.*?)`', r'``\1``', read('CHANGELOG.rst'))), author='Marc Schlaich', author_email='marc.schlaich@gmail.com', - maintainer='Ionel Cristian Mărieș', - maintainer_email='contact@ionelmc.ro', - url='https://github.com/ionelmc/pytest-cover', + url='https://github.com/schlamar/pytest-cov', packages=find_packages('src'), package_dir={'': 'src'}, py_modules=[splitext(basename(path))[0] for path in glob('src/*.py')], @@ -126,7 +124,7 @@ def run(self): }, entry_points={ 'pytest11': [ - 'pytest_cov = pytest_cover.plugin', + 'pytest_cov = pytest_cov.plugin', ], 'console_scripts': [ ] diff --git a/src/pytest-cover.embed b/src/pytest-cov.embed similarity index 87% rename from src/pytest-cover.embed rename to src/pytest-cov.embed index 5e5fa729..31f2fdab 100644 --- a/src/pytest-cover.embed +++ b/src/pytest-cov.embed @@ -1,6 +1,6 @@ if 'COV_CORE_SOURCE' in os.environ: try: - from pytest_cover.embed import init + from pytest_cov.embed import init init() except ImportError: sys.stderr.write( diff --git a/src/pytest-cov.pth b/src/pytest-cov.pth new file mode 100644 index 00000000..8734b5ef --- /dev/null +++ b/src/pytest-cov.pth @@ -0,0 +1 @@ +import os, sys;exec('if \'COV_CORE_SOURCE\' in os.environ:\n try:\n from pytest_cov.embed import init\n init()\n except ImportError:\n sys.stderr.write(\n "Failed to setup coverage."\n "Sources: {[COV_CORE_SOURCE]!r}"\n "Config: {[COV_CORE_CONFIG]!r}"\n "Exception: {!r}\\n".format(os.environ, exc))\n') diff --git a/src/pytest-cover.pth b/src/pytest-cover.pth deleted file mode 100644 index 18376552..00000000 --- a/src/pytest-cover.pth +++ /dev/null @@ -1 +0,0 @@ -import os, sys;exec('if \'COV_CORE_SOURCE\' in os.environ:\n try:\n from pytest_cover.embed import init\n init()\n except ImportError:\n sys.stderr.write(\n "Failed to setup coverage."\n "Sources: {[COV_CORE_SOURCE]!r}"\n "Config: {[COV_CORE_CONFIG]!r}"\n "Exception: {!r}\\n".format(os.environ, exc))\n') \ No newline at end of file diff --git a/src/pytest_cover/__init__.py b/src/pytest_cov/__init__.py similarity index 100% rename from src/pytest_cover/__init__.py rename to src/pytest_cov/__init__.py diff --git a/src/pytest_cover/embed.py b/src/pytest_cov/embed.py similarity index 100% rename from src/pytest_cover/embed.py rename to src/pytest_cov/embed.py diff --git a/src/pytest_cover/engine.py b/src/pytest_cov/engine.py similarity index 100% rename from src/pytest_cover/engine.py rename to src/pytest_cov/engine.py diff --git a/src/pytest_cover/plugin.py b/src/pytest_cov/plugin.py similarity index 100% rename from src/pytest_cover/plugin.py rename to src/pytest_cov/plugin.py diff --git a/tests/test_pytest_cover.py b/tests/test_pytest_cover.py index 87ddcbe5..8b82dd3f 100644 --- a/tests/test_pytest_cover.py +++ b/tests/test_pytest_cover.py @@ -7,7 +7,7 @@ import virtualenv import py import pytest -import pytest_cover.plugin +import pytest_cov.plugin pytest_plugins = 'pytester', 'cov' @@ -584,7 +584,7 @@ def test_dist_boxed(testdir): def test_not_started_plugin_does_not_fail(testdir): - plugin = pytest_cover.plugin.CovPlugin(None, None, start=False) + plugin = pytest_cov.plugin.CovPlugin(None, None, start=False) plugin.pytest_sessionfinish(None, None) plugin.pytest_terminal_summary(None) From 87d77b222ae6a3a87ef41d00b4c4589c486c2c05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sat, 4 Jul 2015 14:45:03 +0300 Subject: [PATCH 44/47] Remove release date (not released yet). --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index dc22f299..6978606e 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,7 +1,7 @@ Changelog ========= -2.0.0 (2015-06-29) +2.0.0 (??????????) ------------------ * Added ``--cov-fail-under``, akin to the new ``fail_under`` option in `coverage-4.0` From a2cd0608391a542473ba9b88bf73b18d4790dd22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sat, 4 Jul 2015 14:45:55 +0300 Subject: [PATCH 45/47] Allow overriding interpreter from env (eg: for AppVeyor where there are 32/64bit variants). --- tox.ini | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tox.ini b/tox.ini index e441da6b..c59abb73 100644 --- a/tox.ini +++ b/tox.ini @@ -9,10 +9,10 @@ envlist = [testenv] basepython = pypy: pypy - 2.6: python2.6 - {2.7,docs}: python2.7 - 3.3: python3.3 - 3.4: python3.4 + 2.6: {env:TOXPYTHON:python2.6} + {2.7,docs}: {env:TOXPYTHON:python2.7} + 3.3: {env:TOXPYTHON:python3.3} + 3.4: {env:TOXPYTHON:python3.4} {clean,check,report,extension-coveralls,coveralls}: python3.4 setenv = PYTHONPATH={toxinidir}/tests From 8c5859b33899296264d3ac6fc0aa59107f8c42f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sun, 5 Jul 2015 15:50:45 +0300 Subject: [PATCH 46/47] Remove some un-necessary cruft. --- ci/bootstrap.py | 64 --------------------- ci/templates/.travis.yml | 27 --------- ci/templates/appveyor.yml | 39 ------------- ci/templates/tox.ini | 117 -------------------------------------- setup.cfg | 15 ----- 5 files changed, 262 deletions(-) delete mode 100755 ci/bootstrap.py delete mode 100644 ci/templates/.travis.yml delete mode 100644 ci/templates/appveyor.yml delete mode 100644 ci/templates/tox.ini diff --git a/ci/bootstrap.py b/ci/bootstrap.py deleted file mode 100755 index 466bb8fe..00000000 --- a/ci/bootstrap.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -from __future__ import absolute_import, print_function, unicode_literals - -import os -import sys -from os.path import exists -from os.path import join -from os.path import dirname -from os.path import abspath - - -if __name__ == "__main__": - base_path = dirname(dirname(abspath(__file__))) - print("Project path: {0}".format(base_path)) - env_path = join(base_path, ".tox", "bootstrap") - if sys.platform == "win32": - bin_path = join(env_path, "Scripts") - else: - bin_path = join(env_path, "bin") - if not exists(env_path): - import subprocess - print("Making bootstrap env in: {0} ...".format(env_path)) - try: - subprocess.check_call(["virtualenv", env_path]) - except Exception: - subprocess.check_call([sys.executable, "-m", "virtualenv", env_path]) - print("Installing `jinja2` and `matrix` into bootstrap environment ...") - subprocess.check_call([join(bin_path, "pip"), "install", "jinja2", "matrix"]) - activate = join(bin_path, "activate_this.py") - exec(compile(open(activate, "rb").read(), activate, "exec"), dict(__file__=activate)) - - import jinja2 - import matrix - - jinja = jinja2.Environment( - loader=jinja2.FileSystemLoader(join(base_path, "ci", "templates")), - trim_blocks=True, - lstrip_blocks=True, - keep_trailing_newline=True - ) - tox_environments = {} - for (alias, conf) in matrix.from_file(join(base_path, "setup.cfg")).items(): - python = conf["python_versions"] - deps = conf["dependencies"] - if "coverage_flags" in conf: - cover = {"false": False, "true": True}[conf["coverage_flags"].lower()] - if "environment_variables" in conf: - env_vars = conf["environment_variables"] - - tox_environments[alias] = { - "python": "python" + python if "py" not in python else python, - "deps": deps.split(), - } - if "coverage_flags" in conf: - tox_environments[alias].update(cover=cover) - if "environment_variables" in conf: - tox_environments[alias].update(env_vars=env_vars.split()) - - for name in os.listdir(join("ci", "templates")): - with open(join(base_path, name), "w") as fh: - fh.write(jinja.get_template(name).render(tox_environments=tox_environments)) - print("Wrote {}".format(name)) - print("DONE.") diff --git a/ci/templates/.travis.yml b/ci/templates/.travis.yml deleted file mode 100644 index b1d89b30..00000000 --- a/ci/templates/.travis.yml +++ /dev/null @@ -1,27 +0,0 @@ -language: python -python: 2.7 -sudo: false -env: - global: - LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so - matrix: - - TOXENV=check -{% for env, config in tox_environments|dictsort %} - - TOXENV={{ env }}{% if config.cover %},coveralls{% endif %} - -{% endfor %} -before_install: - - python --version - - virtualenv --version - - pip --version - - uname -a - - lsb_release -a -install: - - pip install tox -script: - - tox -v -notifications: - email: - on_success: never - on_failure: always - diff --git a/ci/templates/appveyor.yml b/ci/templates/appveyor.yml deleted file mode 100644 index 55310322..00000000 --- a/ci/templates/appveyor.yml +++ /dev/null @@ -1,39 +0,0 @@ -version: '{branch}-{build}' -build: off -environment: - global: - WITH_COMPILER: "cmd /E:ON /V:ON /C .\\ci\\appveyor-with-compiler.cmd" - matrix: - - TOXENV: check - PYTHON_HOME: "C:\\Python27" - PYTHON_VERSION: "2.7" - PYTHON_ARCH: "32" -{% for env, config in tox_environments|dictsort %}{% if env.startswith('2.7') or env.startswith('3.4') or env.startswith('3.3') %} - - TOXENV: "{{ env }}" - TOXPYTHON: "C:\\Python{{ env[:3].replace('.', '') }}\\python.exe" - WINDOWS_SDK_VERSION: "v7.{{ '1' if env[0] == '3' else '0' }}" - PYTHON_HOME: "C:\\Python{{ env[:3].replace('.', '') }}" - PYTHON_VERSION: "{{ env[:3] }}" - PYTHON_ARCH: "32" - - TOXENV: "{{ env }}" - TOXPYTHON: "C:\\Python{{ env[:3].replace('.', '') }}-x64\\python.exe" - WINDOWS_SDK_VERSION: "v7.{{ '1' if env[0] == '3' else '0' }}" - PYTHON_HOME: "C:\\Python{{ env[:3].replace('.', '') }}-x64" - PYTHON_VERSION: "{{ env[:3] }}" - PYTHON_ARCH: "64" -{% endif %}{% endfor %} -init: - - "ECHO %TOXENV%" - - ps: "ls C:\\Python*" -install: - - "powershell ci\\appveyor-bootstrap.ps1" -test_script: - - "%PYTHON_HOME%\\Scripts\\tox --version" - - "%PYTHON_HOME%\\Scripts\\virtualenv --version" - - "%PYTHON_HOME%\\Scripts\\pip --version" - - "%WITH_COMPILER% %PYTHON_HOME%\\Scripts\\tox" -after_test: - - "IF \"%TOXENV:~-8,8%\" == \"-nocover\" %WITH_COMPILER% %TOXPYTHON% setup.py bdist_wheel" -artifacts: - - path: dist\* - diff --git a/ci/templates/tox.ini b/ci/templates/tox.ini deleted file mode 100644 index c96fb687..00000000 --- a/ci/templates/tox.ini +++ /dev/null @@ -1,117 +0,0 @@ -[tox] -envlist = - clean, - check, -{% for env in tox_environments|sort %} - {{ env }}, -{% endfor %} - report, - docs - -[testenv] -setenv = - PYTHONPATH={toxinidir}/tests - PYTHONUNBUFFERED=yes -passenv = - * -deps = - pytest - pytest-capturelog -commands = - {posargs:py.test -vv --ignore=src} - -[testenv:spell] -setenv = - SPELLCHECK = 1 -commands = - sphinx-build -b spelling docs dist/docs -usedevelop = true -deps = - -r{toxinidir}/docs/requirements.txt - sphinxcontrib-spelling - pyenchant - -[testenv:docs] -whitelist_externals = - rm -commands = - sphinx-build {posargs:-E} -b html docs dist/docs - sphinx-build -b linkcheck docs dist/docs -usedevelop = true -deps = - -r{toxinidir}/docs/requirements.txt - -[testenv:configure] -deps = - jinja2 - matrix -usedevelop = true -commands = - python bootstrap.py - -[testenv:check] -basepython = python3.4 -deps = - docutils - check-manifest - flake8 - readme - pygments -usedevelop = true -commands = - python setup.py check --strict --metadata --restructuredtext - check-manifest {toxinidir} - flake8 src - -[testenv:coveralls] -deps = - coveralls -usedevelop = true -commands = - coverage combine - coverage report - coveralls - -[testenv:report] -basepython = python3.4 -commands = - coverage combine - coverage report -usedevelop = true -deps = coverage - -[testenv:clean] -commands = coverage erase -usedevelop = true -deps = coverage - -{% for env, config in tox_environments|dictsort %} -[testenv:{{ env }}] -basepython = {{ config.python }} -{% if config.cover or config.env_vars %} -setenv = - {[testenv]setenv} -{% endif %} -{% for var in config.env_vars %} - {{ var }} -{% endfor %} -{% if config.cover %} - WITH_COVERAGE=yes -usedevelop = true -commands = - {posargs:py.test --cov=src --cov-report=term-missing -vv} -{% endif %} -{% if config.cover or config.deps %} -deps = - {[testenv]deps} -{% endif %} -{% if config.cover %} - pytest-cov -{% endif %} -{% for dep in config.deps %} - {{ dep }} -{% endfor %} - -{% endfor %} - - diff --git a/setup.cfg b/setup.cfg index 89d17ff1..9846450e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -50,18 +50,3 @@ line_length = 120 known_first_party = pytest_cov default_section = THIRDPARTY forced_separate = test_pytest_cover - -[matrix] -python_versions = - 2.6 - 2.7 - 3.3 - 3.4 - pypy -dependencies = -coverage_flags = - : true - nocover: false -environment_variables = - - - From 5b91aff62aaed7c013dc3a6b7fa1944ecaa559a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Sun, 5 Jul 2015 15:51:34 +0300 Subject: [PATCH 47/47] Extend the changelog with some of the changes mentioned in #28. --- CHANGELOG.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 6978606e..8b94fa3d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -12,6 +12,9 @@ Changelog settings from ``.coveragerc`` will be used instead). * Fixed `.pth` installation to work in all cases (install, easy_install, wheels, develop etc). * Fixed `.pth` uninstallation to work for wheel installs. +* Support for coverage 4.0. +* Data file suffixing changed to use coverage's ``data_suffix=True`` option (instead of the + custom suffixing). 1.8.2 (2014-11-06) ------------------