diff --git a/.travis.yml b/.travis.yml index 09b06ede..978ea5de 100644 --- a/.travis.yml +++ b/.travis.yml @@ -77,50 +77,98 @@ jobs: python: '3.6' - env: TOXENV=py36-pytest46-xdist29-coverage50 python: '3.6' + - env: TOXENV=py36-pytest46-xdist30-coverage45 + python: '3.6' + - env: TOXENV=py36-pytest46-xdist30-coverage50 + python: '3.6' - env: TOXENV=py36-pytest51-xdist29-coverage45 python: '3.6' - env: TOXENV=py36-pytest51-xdist29-coverage50 python: '3.6' + - env: TOXENV=py36-pytest51-xdist30-coverage45 + python: '3.6' + - env: TOXENV=py36-pytest51-xdist30-coverage50 + python: '3.6' - env: TOXENV=py36-pytest52-xdist29-coverage45 python: '3.6' - env: TOXENV=py36-pytest52-xdist29-coverage50 python: '3.6' + - env: TOXENV=py36-pytest52-xdist30-coverage45 + python: '3.6' + - env: TOXENV=py36-pytest52-xdist30-coverage50 + python: '3.6' - env: TOXENV=py37-pytest46-xdist29-coverage45 python: '3.7' - env: TOXENV=py37-pytest46-xdist29-coverage50 python: '3.7' + - env: TOXENV=py37-pytest46-xdist30-coverage45 + python: '3.7' + - env: TOXENV=py37-pytest46-xdist30-coverage50 + python: '3.7' - env: TOXENV=py37-pytest51-xdist29-coverage45 python: '3.7' - env: TOXENV=py37-pytest51-xdist29-coverage50 python: '3.7' + - env: TOXENV=py37-pytest51-xdist30-coverage45 + python: '3.7' + - env: TOXENV=py37-pytest51-xdist30-coverage50 + python: '3.7' - env: TOXENV=py37-pytest52-xdist29-coverage45 python: '3.7' - env: TOXENV=py37-pytest52-xdist29-coverage50 python: '3.7' + - env: TOXENV=py37-pytest52-xdist30-coverage45 + python: '3.7' + - env: TOXENV=py37-pytest52-xdist30-coverage50 + python: '3.7' - env: TOXENV=py38-pytest46-xdist29-coverage45 python: '3.8-dev' - env: TOXENV=py38-pytest46-xdist29-coverage50 python: '3.8-dev' + - env: TOXENV=py38-pytest46-xdist30-coverage45 + python: '3.8-dev' + - env: TOXENV=py38-pytest46-xdist30-coverage50 + python: '3.8-dev' - env: TOXENV=py38-pytest51-xdist29-coverage45 python: '3.8-dev' - env: TOXENV=py38-pytest51-xdist29-coverage50 python: '3.8-dev' + - env: TOXENV=py38-pytest51-xdist30-coverage45 + python: '3.8-dev' + - env: TOXENV=py38-pytest51-xdist30-coverage50 + python: '3.8-dev' - env: TOXENV=py38-pytest52-xdist29-coverage45 python: '3.8-dev' - env: TOXENV=py38-pytest52-xdist29-coverage50 python: '3.8-dev' + - env: TOXENV=py38-pytest52-xdist30-coverage45 + python: '3.8-dev' + - env: TOXENV=py38-pytest52-xdist30-coverage50 + python: '3.8-dev' - env: TOXENV=pypy3-pytest46-xdist29-coverage45 python: 'pypy3' - env: TOXENV=pypy3-pytest46-xdist29-coverage50 python: 'pypy3' + - env: TOXENV=pypy3-pytest46-xdist30-coverage45 + python: 'pypy3' + - env: TOXENV=pypy3-pytest46-xdist30-coverage50 + python: 'pypy3' - env: TOXENV=pypy3-pytest51-xdist29-coverage45 python: 'pypy3' - env: TOXENV=pypy3-pytest51-xdist29-coverage50 python: 'pypy3' + - env: TOXENV=pypy3-pytest51-xdist30-coverage45 + python: 'pypy3' + - env: TOXENV=pypy3-pytest51-xdist30-coverage50 + python: 'pypy3' - env: TOXENV=pypy3-pytest52-xdist29-coverage45 python: 'pypy3' - env: TOXENV=pypy3-pytest52-xdist29-coverage50 python: 'pypy3' + - env: TOXENV=pypy3-pytest52-xdist30-coverage45 + python: 'pypy3' + - env: TOXENV=pypy3-pytest52-xdist30-coverage50 + python: 'pypy3' - stage: examples python: '3.6' diff --git a/AUTHORS.rst b/AUTHORS.rst index 03782571..3b65134f 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -30,4 +30,9 @@ Authors * Семён Марьясин - https://github.com/MarSoft * Alexander Shadchin - https://github.com/shadchin * Thomas Grainger - https://graingert.co.uk -* Ned Batchelder - https://nedbatchelder.com +* Juanjo Bazán - https://github.com/xuanxu +* Andrew Murray - https://github.com/radarhere +* Ned Batchelder - https://nedbatchelder.com/ +* Albert Tugushev - https://github.com/atugushev +* Martín Gaitán - https://github.com/mgaitan +* Hugo van Kemenade - https://github.com/hugovk diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 6514982a..3b323b8f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,13 +1,47 @@ Changelog ========= -2.7.2.dev0 (unreleased) ------------------------ +2.8.0 (2019-10-03) +------------------ -* Added --cov-context option for setting the coverage.py dynamic context for - each test. -* Match pytest-xdist master/worker terminology. - Contributed in `#321 `_ +* Fixed ``RecursionError`` that can occur when using + `cleanup_on_signal `__ or + `cleanup_on_sigterm `__. + See: `#294 `_. + The 2.7.x releases of pytest-cov should be considered broken regarding aforementioned cleanup API. +* Added compatibility with future xdist release that deprecates some internals + (match pytest-xdist master/worker terminology). + Contributed by Thomas Grainger in `#321 `_ +* Fixed breakage that occurs when multiple reporting options are used. + Contributed by Thomas Grainger in `#338 `_. +* Changed internals to use a stub instead of ``os.devnull``. + Contributed by Thomas Grainger in `#332 `_. +* Added support for Coverage 5.0. + Contributed by Ned Batchelder in `#319 `_. +* Added support for float values in ``--cov-fail-under``. + Contributed by Martín Gaitán in `#311 `_. +* Various documentation fixes. Contributed by + Juanjo Bazán, + Andrew Murray and + Albert Tugushev in + `#298 `_, + `#299 `_ and + `#307 `_. +* Various testing improvements. Contributed by + Ned Batchelder, + Daniel Hahler, + Ionel Cristian Mărieș and + Hugo van Kemenade in + `#313 `_, + `#314 `_, + `#315 `_, + `#316 `_, + `#325 `_, + `#326 `_, + `#334 `_ and + `#335 `_. +* Added the ``--cov-context`` CLI options that enables coverage contexts. Only works with coverage 5.0+. + Contributed by Ned Batchelder in `#345 `_. 2.7.1 (2019-05-03) ------------------ diff --git a/appveyor.yml b/appveyor.yml index bf561d77..81ac635d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,8 +7,8 @@ environment: - TOXENV: 'py27-pytest310-xdist27-coverage45,py27-pytest46-xdist27-coverage45,py27-pytest310-xdist27-coverage50,py27-pytest46-xdist27-coverage50' - TOXENV: 'py34-pytest310-xdist27-coverage45,py34-pytest46-xdist27-coverage45' - TOXENV: 'py35-pytest310-xdist27-coverage45,py35-pytest46-xdist27-coverage45,py35-pytest310-xdist27-coverage50,py35-pytest46-xdist27-coverage50' - - TOXENV: 'py36-pytest310-xdist27-coverage45,py36-pytest46-xdist27-coverage45,py36-pytest310-xdist27-coverage50,py36-pytest46-xdist27-coverage50,py36-pytest46-xdist29-coverage45,py36-pytest46-xdist29-coverage50,py36-pytest51-xdist29-coverage45,py36-pytest51-xdist29-coverage50,py36-pytest52-xdist29-coverage45,py36-pytest52-xdist29-coverage50' - - TOXENV: 'py37-pytest310-xdist27-coverage45,py37-pytest46-xdist27-coverage45,py37-pytest310-xdist27-coverage50,py37-pytest46-xdist27-coverage50,py37-pytest46-xdist29-coverage45,py37-pytest46-xdist29-coverage50,py37-pytest51-xdist29-coverage45,py37-pytest51-xdist29-coverage50,py37-pytest52-xdist29-coverage45,py37-pytest52-xdist29-coverage50' + - TOXENV: 'py36-pytest310-xdist27-coverage45,py36-pytest46-xdist27-coverage45,py36-pytest310-xdist27-coverage50,py36-pytest46-xdist27-coverage50,py36-pytest46-xdist29-coverage45,py36-pytest46-xdist29-coverage50,py36-pytest46-xdist30-coverage45,py36-pytest46-xdist30-coverage50,py36-pytest51-xdist29-coverage45,py36-pytest51-xdist29-coverage50,py36-pytest51-xdist30-coverage45,py36-pytest51-xdist30-coverage50,py36-pytest52-xdist29-coverage45,py36-pytest52-xdist29-coverage50,py36-pytest52-xdist30-coverage45,py36-pytest52-xdist30-coverage50' + - TOXENV: 'py37-pytest310-xdist27-coverage45,py37-pytest46-xdist27-coverage45,py37-pytest310-xdist27-coverage50,py37-pytest46-xdist27-coverage50,py37-pytest46-xdist29-coverage45,py37-pytest46-xdist29-coverage50,py37-pytest46-xdist30-coverage45,py37-pytest46-xdist30-coverage50,py37-pytest51-xdist29-coverage45,py37-pytest51-xdist29-coverage50,py37-pytest51-xdist30-coverage45,py37-pytest51-xdist30-coverage50,py37-pytest52-xdist29-coverage45,py37-pytest52-xdist29-coverage50,py37-pytest52-xdist30-coverage45,py37-pytest52-xdist30-coverage50' - TOXENV: 'pypy-pytest310-xdist27-coverage45,pypy-pytest46-xdist27-coverage45,pypy-pytest310-xdist27-coverage50,pypy-pytest46-xdist27-coverage50' init: diff --git a/ci/bootstrap.py b/ci/bootstrap.py index 46df8a40..6c77dfcb 100755 --- a/ci/bootstrap.py +++ b/ci/bootstrap.py @@ -1,8 +1,11 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -from __future__ import absolute_import, print_function, unicode_literals +from __future__ import absolute_import +from __future__ import print_function +from __future__ import unicode_literals import os +import subprocess import sys from collections import defaultdict from os.path import abspath @@ -10,9 +13,14 @@ from os.path import exists from os.path import join -if __name__ == "__main__": - base_path = dirname(dirname(abspath(__file__))) - print("Project path: {0}".format(base_path)) +base_path = dirname(dirname(abspath(__file__))) + + +def check_call(args): + print("+", *args) + subprocess.check_call(args) + +def exec_in_env(): env_path = join(base_path, ".tox", "bootstrap") if sys.platform == "win32": bin_path = join(env_path, "Scripts") @@ -23,19 +31,26 @@ print("Making bootstrap env in: {0} ...".format(env_path)) try: - subprocess.check_call(["virtualenv", env_path]) + check_call([sys.executable, "-m", "venv", env_path]) except subprocess.CalledProcessError: - subprocess.check_call([sys.executable, "-m", "virtualenv", env_path]) + try: + check_call([sys.executable, "-m", "virtualenv", env_path]) + except subprocess.CalledProcessError: + check_call(["virtualenv", env_path]) print("Installing `jinja2` into bootstrap environment...") - subprocess.check_call([join(bin_path, "pip"), "install", "jinja2"]) + check_call([join(bin_path, "pip"), "install", "jinja2", "tox"]) python_executable = join(bin_path, "python") - if not os.path.samefile(python_executable, sys.executable): - print("Re-executing with: {0}".format(python_executable)) - os.execv(python_executable, [python_executable, __file__]) + if not os.path.exists(python_executable): + python_executable += '.exe' + + print("Re-executing with: {0}".format(python_executable)) + print("+ exec", python_executable, __file__, "--no-env") + os.execv(python_executable, [python_executable, __file__, "--no-env"]) +def main(): import jinja2 - import subprocess + print("Project path: {0}".format(base_path)) jinja = jinja2.Environment( loader=jinja2.FileSystemLoader(join(base_path, "ci", "templates")), @@ -63,3 +78,14 @@ fh.write(jinja.get_template(name).render(**template_vars)) print("Wrote {}".format(name)) print("DONE.") + +if __name__ == "__main__": + args = sys.argv[1:] + if args == ["--no-env"]: + main() + elif not args: + exec_in_env() + else: + print("Unexpected arguments {0}".format(args), file=sys.stderr) + sys.exit(1) + diff --git a/tox.ini b/tox.ini index fd5a9f5c..1040aafe 100644 --- a/tox.ini +++ b/tox.ini @@ -5,7 +5,7 @@ envlist = check py{27,34,35,36,37,py,py3}-pytest{310,46}-xdist27-coverage45 py{27,35,36,37,py,py3}-pytest{310,46}-xdist27-coverage50 - py{36,37,38,py3}-pytest{46,51,52}-xdist29-coverage{45,50} + py{36,37,38,py3}-pytest{46,51,52}-xdist{29,30}-coverage{45,50} docs [testenv] @@ -28,6 +28,7 @@ setenv = xdist27: _DEP_PYTESTXDIST=pytest-xdist==1.27.0 xdist28: _DEP_PYTESTXDIST=pytest-xdist==1.28.0 xdist29: _DEP_PYTESTXDIST=pytest-xdist==1.29.0 + xdist30: _DEP_PYTESTXDIST=pytest-xdist==1.30.0 coverage45: _DEP_COVERAGE=coverage==4.5.4 coverage50: _DEP_COVERAGE=coverage==5.0a8