From 77526f412c46099785f567a49edbeddb6688fa60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20S=C3=BAkup?= Date: Thu, 4 Apr 2019 12:53:55 +0200 Subject: [PATCH 01/14] Skip test_source_mtime_long_long on 32bit and lower platforms --- testing/test_assertrewrite.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/testing/test_assertrewrite.py b/testing/test_assertrewrite.py index 72bfbcc55..fb3f81770 100644 --- a/testing/test_assertrewrite.py +++ b/testing/test_assertrewrite.py @@ -1232,6 +1232,9 @@ class TestIssue2121: result.stdout.fnmatch_lines(["*E*assert (1 + 1) == 3"]) +@pytest.mark.skipif( + sys.maxsize <= (2 ** 31 - 1), reason="Causes OverflowError on 32bit systems" +) @pytest.mark.parametrize("offset", [-1, +1]) def test_source_mtime_long_long(testdir, offset): """Support modification dates after 2038 in rewritten files (#4903). From 26b41a59148968f98b62a6b862181577202f0a03 Mon Sep 17 00:00:00 2001 From: Hugo Date: Sat, 4 May 2019 17:54:57 +0300 Subject: [PATCH 02/14] Upgrade PyPy to 7.1.1 --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 977ab1b60..ecbba1255 100644 --- a/.travis.yml +++ b/.travis.yml @@ -49,9 +49,9 @@ jobs: # Coverage tracking is slow with pypy, skip it. - env: TOXENV=pypy-xdist - python: 'pypy2.7-6.0' + python: 'pypy' - env: TOXENV=pypy3-xdist - python: 'pypy3.5-6.0' + python: 'pypy3' - env: TOXENV=py34-xdist python: '3.4' From 143499d0418284ab98c0c223609cc5df6bbfd30a Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Sat, 4 May 2019 08:28:50 -0700 Subject: [PATCH 03/14] Update Black URLs > Black, your uncompromising #Python code formatter, was a project > created with the community in mind from Day 1. Today we moved it under > the PSF umbrella. It's now available on GitHub under > https://github.com/python/black/ . You install and use it just like > before. https://twitter.com/llanga/status/1123980466292445190 --- .pre-commit-config.yaml | 2 +- CONTRIBUTING.rst | 2 +- README.rst | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 737c6b86b..15fefcb35 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ exclude: doc/en/example/py2py3/test_py2.py repos: -- repo: https://github.com/ambv/black +- repo: https://github.com/python/black rev: 19.3b0 hooks: - id: black diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index ea778149c..57628a34b 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -166,7 +166,7 @@ Short version #. Enable and install `pre-commit `_ to ensure style-guides and code checks are followed. #. Target ``master`` for bugfixes and doc changes. #. Target ``features`` for new features or functionality changes. -#. Follow **PEP-8** for naming and `black `_ for formatting. +#. Follow **PEP-8** for naming and `black `_ for formatting. #. Tests are run using ``tox``:: tox -e linting,py27,py37 diff --git a/README.rst b/README.rst index 1955d3503..fab6072dd 100644 --- a/README.rst +++ b/README.rst @@ -26,7 +26,7 @@ :target: https://dev.azure.com/pytest-dev/pytest .. image:: https://img.shields.io/badge/code%20style-black-000000.svg - :target: https://github.com/ambv/black + :target: https://github.com/python/black .. image:: https://www.codetriage.com/pytest-dev/pytest/badges/users.svg :target: https://www.codetriage.com/pytest-dev/pytest From 784e1e3b7ecb0987c45668c57b68125c46f46798 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Mon, 6 May 2019 12:35:27 -0300 Subject: [PATCH 04/14] Add links to pytest.raises `message` workaround Related to #3974 --- doc/en/deprecations.rst | 2 ++ doc/en/getting-started.rst | 2 +- src/_pytest/python_api.py | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/en/deprecations.rst b/doc/en/deprecations.rst index 27af2a49a..a505c0a94 100644 --- a/doc/en/deprecations.rst +++ b/doc/en/deprecations.rst @@ -19,6 +19,8 @@ Below is a complete list of all pytest features which are considered deprecated. :class:`_pytest.warning_types.PytestWarning` or subclasses, which can be filtered using :ref:`standard warning filters `. +.. _`raises message deprecated`: + ``"message"`` parameter of ``pytest.raises`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/doc/en/getting-started.rst b/doc/en/getting-started.rst index 0ba19cbba..d6c62cbe8 100644 --- a/doc/en/getting-started.rst +++ b/doc/en/getting-started.rst @@ -83,7 +83,7 @@ Run multiple tests Assert that a certain exception is raised -------------------------------------------------------------- -Use the ``raises`` helper to assert that some code raises an exception:: +Use the :ref:`raises ` helper to assert that some code raises an exception:: # content of test_sysexit.py import pytest diff --git a/src/_pytest/python_api.py b/src/_pytest/python_api.py index 66de85468..84fffd7aa 100644 --- a/src/_pytest/python_api.py +++ b/src/_pytest/python_api.py @@ -561,7 +561,7 @@ def raises(expected_exception, *args, **kwargs): :kwparam match: if specified, asserts that the exception matches a text or regex :kwparam message: **(deprecated since 4.1)** if specified, provides a custom failure message - if the exception is not raised + if the exception is not raised. See :ref:`the deprecation docs ` for a workaround. .. currentmodule:: _pytest._code @@ -597,6 +597,7 @@ def raises(expected_exception, *args, **kwargs): ``message`` to specify a custom failure message that will be displayed in case the ``pytest.raises`` check fails. This has been deprecated as it is considered error prone as users often mean to use ``match`` instead. + See :ref:`the deprecation docs ` for a workaround. .. note:: From 2795689435f1e7155b2266d3bd9aa74b6a247b65 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Mon, 6 May 2019 19:42:06 -0300 Subject: [PATCH 05/14] Restore usedevelop=True now that pip 19.1.1 restored the old behavior Fix #5167 --- tox.ini | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tox.ini b/tox.ini index 4111ee4f5..eb0402f6a 100644 --- a/tox.ini +++ b/tox.ini @@ -73,8 +73,7 @@ commands = pre-commit run --all-files --show-diff-on-failure [testenv:docs] basepython = python3 -# broken due to pip 19.1 (#5167) -# usedevelop = True +usedevelop = True changedir = doc/en deps = -r{toxinidir}/doc/en/requirements.txt @@ -128,8 +127,7 @@ commands = [testenv:release] decription = do a release, required posarg of the version number basepython = python3.6 -# broken due to pip 19.1 (#5167) -# usedevelop = True +usedevelop = True passenv = * deps = colorama From 8b34d981fc378f06b65d0866e6bd2c66d29680b3 Mon Sep 17 00:00:00 2001 From: Peter Schutt Date: Tue, 7 May 2019 09:56:13 +1000 Subject: [PATCH 06/14] Clarify docs for pytest.raises `match`. For #5208. Document explicit behavior of `match` and brief note on how to handle matching a string that may contain special re chars. --- src/_pytest/python_api.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/_pytest/python_api.py b/src/_pytest/python_api.py index 84fffd7aa..ae466a063 100644 --- a/src/_pytest/python_api.py +++ b/src/_pytest/python_api.py @@ -558,7 +558,13 @@ def raises(expected_exception, *args, **kwargs): Assert that a code block/function call raises ``expected_exception`` or raise a failure exception otherwise. - :kwparam match: if specified, asserts that the exception matches a text or regex + :kwparam match: if specified, a string containing a regular expression, + or a regular expression object, that is tested against the string + representation of the exception using ``re.match``. To match a literal + string that may contain ``special characters``__, the pattern can + first be escaped with ``re.escape``. + + __ https://docs.python.org/3/library/re.html#regular-expression-syntax :kwparam message: **(deprecated since 4.1)** if specified, provides a custom failure message if the exception is not raised. See :ref:`the deprecation docs ` for a workaround. From 8605ed2a152217651125ccb3ff824a76a7776465 Mon Sep 17 00:00:00 2001 From: Peter Schutt Date: Tue, 7 May 2019 10:10:25 +1000 Subject: [PATCH 07/14] Update python_api.py --- src/_pytest/python_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_pytest/python_api.py b/src/_pytest/python_api.py index ae466a063..cf3cb1080 100644 --- a/src/_pytest/python_api.py +++ b/src/_pytest/python_api.py @@ -561,7 +561,7 @@ def raises(expected_exception, *args, **kwargs): :kwparam match: if specified, a string containing a regular expression, or a regular expression object, that is tested against the string representation of the exception using ``re.match``. To match a literal - string that may contain ``special characters``__, the pattern can + string that may contain `special characters`__, the pattern can first be escaped with ``re.escape``. __ https://docs.python.org/3/library/re.html#regular-expression-syntax From d3686361ba452a29a462336365b52d1ad32f6017 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 7 May 2019 00:52:40 +0000 Subject: [PATCH 08/14] Fix linting --- src/_pytest/python_api.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/_pytest/python_api.py b/src/_pytest/python_api.py index cf3cb1080..4aac32ba5 100644 --- a/src/_pytest/python_api.py +++ b/src/_pytest/python_api.py @@ -558,12 +558,12 @@ def raises(expected_exception, *args, **kwargs): Assert that a code block/function call raises ``expected_exception`` or raise a failure exception otherwise. - :kwparam match: if specified, a string containing a regular expression, - or a regular expression object, that is tested against the string - representation of the exception using ``re.match``. To match a literal - string that may contain `special characters`__, the pattern can + :kwparam match: if specified, a string containing a regular expression, + or a regular expression object, that is tested against the string + representation of the exception using ``re.match``. To match a literal + string that may contain `special characters`__, the pattern can first be escaped with ``re.escape``. - + __ https://docs.python.org/3/library/re.html#regular-expression-syntax :kwparam message: **(deprecated since 4.1)** if specified, provides a custom failure message From d1a48ad68ffa71f9dc941e46a07289be8aa7b546 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Mon, 6 May 2019 23:07:39 -0700 Subject: [PATCH 09/14] Use exec directly --- bench/empty.py | 4 +--- doc/en/example/assertion/failure_demo.py | 4 +--- doc/en/example/reportingdemo.rst | 2 +- src/_pytest/_code/code.py | 3 +-- src/_pytest/assertion/rewrite.py | 2 +- src/_pytest/python_api.py | 3 +-- src/_pytest/recwarn.py | 2 +- testing/code/test_source.py | 4 ++-- testing/test_assertrewrite.py | 2 +- 9 files changed, 10 insertions(+), 16 deletions(-) diff --git a/bench/empty.py b/bench/empty.py index 338ebf138..4e7371b6f 100644 --- a/bench/empty.py +++ b/bench/empty.py @@ -1,4 +1,2 @@ -import six - for i in range(1000): - six.exec_("def test_func_%d(): pass" % i) + exec("def test_func_%d(): pass" % i) diff --git a/doc/en/example/assertion/failure_demo.py b/doc/en/example/assertion/failure_demo.py index 31a9f2577..5d36fa659 100644 --- a/doc/en/example/assertion/failure_demo.py +++ b/doc/en/example/assertion/failure_demo.py @@ -1,5 +1,3 @@ -import six - import _pytest._code import pytest from pytest import raises @@ -199,7 +197,7 @@ def test_dynamic_compile_shows_nicely(): name = "abc-123" module = imp.new_module(name) code = _pytest._code.compile(src, name, "exec") - six.exec_(code, module.__dict__) + exec(code, module.__dict__) sys.modules[name] = module module.foo() diff --git a/doc/en/example/reportingdemo.rst b/doc/en/example/reportingdemo.rst index 26c6e1b9e..824e8398f 100644 --- a/doc/en/example/reportingdemo.rst +++ b/doc/en/example/reportingdemo.rst @@ -460,7 +460,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: name = "abc-123" module = imp.new_module(name) code = _pytest._code.compile(src, name, "exec") - six.exec_(code, module.__dict__) + exec(code, module.__dict__) sys.modules[name] = module > module.foo() diff --git a/src/_pytest/_code/code.py b/src/_pytest/_code/code.py index d87600367..a0b3c78ce 100644 --- a/src/_pytest/_code/code.py +++ b/src/_pytest/_code/code.py @@ -13,7 +13,6 @@ from weakref import ref import attr import pluggy import py -import six from six import text_type import _pytest @@ -138,7 +137,7 @@ class Frame(object): """ f_locals = self.f_locals.copy() f_locals.update(vars) - six.exec_(code, self.f_globals, f_locals) + exec(code, self.f_globals, f_locals) def repr(self, object): """ return a 'safe' (non-recursive, one-line) string repr for 'object' diff --git a/src/_pytest/assertion/rewrite.py b/src/_pytest/assertion/rewrite.py index 18506d2e1..0de3e190f 100644 --- a/src/_pytest/assertion/rewrite.py +++ b/src/_pytest/assertion/rewrite.py @@ -296,7 +296,7 @@ class AssertionRewritingHook(object): mod.__loader__ = self # Normally, this attribute is 3.4+ mod.__spec__ = spec_from_file_location(name, co.co_filename, loader=self) - six.exec_(co, mod.__dict__) + exec(co, mod.__dict__) except: # noqa if name in sys.modules: del sys.modules[name] diff --git a/src/_pytest/python_api.py b/src/_pytest/python_api.py index 4aac32ba5..7e7570008 100644 --- a/src/_pytest/python_api.py +++ b/src/_pytest/python_api.py @@ -7,7 +7,6 @@ import warnings from decimal import Decimal from numbers import Number -import six from more_itertools.more import always_iterable from six.moves import filterfalse from six.moves import zip @@ -702,7 +701,7 @@ def raises(expected_exception, *args, **kwargs): # print "raises frame scope: %r" % frame.f_locals try: code = _pytest._code.Source(code).compile(_genframe=frame) - six.exec_(code, frame.f_globals, loc) + exec(code, frame.f_globals, loc) # XXX didn't mean f_globals == f_locals something special? # this is destroyed here ... except expected_exception: diff --git a/src/_pytest/recwarn.py b/src/_pytest/recwarn.py index 3e2ec86de..394d91911 100644 --- a/src/_pytest/recwarn.py +++ b/src/_pytest/recwarn.py @@ -102,7 +102,7 @@ def warns(expected_warning, *args, **kwargs): with WarningsChecker(expected_warning): code = _pytest._code.Source(code).compile() - six.exec_(code, frame.f_globals, loc) + exec(code, frame.f_globals, loc) else: func = args[0] with WarningsChecker(expected_warning): diff --git a/testing/code/test_source.py b/testing/code/test_source.py index aa56273c4..b62169995 100644 --- a/testing/code/test_source.py +++ b/testing/code/test_source.py @@ -312,7 +312,7 @@ class TestSourceParsingAndCompiling(object): def test_compile_and_getsource(self): co = self.source.compile() - six.exec_(co, globals()) + exec(co, globals()) f(7) excinfo = pytest.raises(AssertionError, f, 6) frame = excinfo.traceback[-1].frame @@ -376,7 +376,7 @@ def test_getfuncsource_dynamic(): def g(): pass """ co = _pytest._code.compile(source) - six.exec_(co, globals()) + exec(co, globals()) assert str(_pytest._code.Source(f)).strip() == "def f():\n raise ValueError" assert str(_pytest._code.Source(g)).strip() == "def g(): pass" diff --git a/testing/test_assertrewrite.py b/testing/test_assertrewrite.py index 72bfbcc55..eec2e393a 100644 --- a/testing/test_assertrewrite.py +++ b/testing/test_assertrewrite.py @@ -52,7 +52,7 @@ def getmsg(f, extra_ns=None, must_pass=False): ns = {} if extra_ns is not None: ns.update(extra_ns) - six.exec_(code, ns) + exec(code, ns) func = ns[f.__name__] try: func() From 7161f5b3726c569e184353059c6d382e9b5da53f Mon Sep 17 00:00:00 2001 From: Sitaktif Date: Wed, 8 May 2019 15:56:28 +0100 Subject: [PATCH 10/14] Require pluggy>=0.11 Pluggy 0.10.0 introduced a new dependency `importlib-metadata` but that package cannot be imported when installed as an egg and that is causing problems for users relying on `setup.py` to install packages present in `test_require`. This change was quickly reverted in pluggy 0.11.0. See https://github.com/pytest-dev/pluggy/issues/205 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index a924d4aba..08c559c93 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ INSTALL_REQUIRES = [ 'funcsigs>=1.0;python_version<"3.0"', 'pathlib2>=2.2.0;python_version<"3.6"', 'colorama;sys_platform=="win32"', - "pluggy>=0.9", + "pluggy>=0.11", ] From 0cf267f187949c1c84d48e200d4511d8d8097265 Mon Sep 17 00:00:00 2001 From: Romain Chossart Date: Wed, 8 May 2019 16:12:39 +0100 Subject: [PATCH 11/14] Add changelog entry for #5229 --- changelog/5229.bugfix.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changelog/5229.bugfix.rst diff --git a/changelog/5229.bugfix.rst b/changelog/5229.bugfix.rst new file mode 100644 index 000000000..948ac6509 --- /dev/null +++ b/changelog/5229.bugfix.rst @@ -0,0 +1,2 @@ +Require ``pluggy>=0.11.0`` which reverts a dependency to ``importlib-metadata`` added in ``0.10.0``. +The ``importlib-metadata`` package cannot be imported when installed as an egg and causes issues when relying on ``setup.py`` to install test dependencies. From 3ac43314eeb3285b3680c8e481a5067b3115c46a Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 8 May 2019 12:46:14 -0300 Subject: [PATCH 12/14] Preparing release version 4.4.2 --- CHANGELOG.rst | 33 +++++++++++ changelog/5089.bugfix.rst | 1 - changelog/5139.bugfix.rst | 1 - changelog/5171.doc.rst | 1 - changelog/5182.trivial.rst | 1 - changelog/5188.doc.rst | 1 - changelog/5229.bugfix.rst | 2 - doc/en/announce/index.rst | 1 + doc/en/announce/release-4.4.2.rst | 33 +++++++++++ doc/en/example/reportingdemo.rst | 98 +++++++++++++++---------------- doc/en/usage.rst | 6 +- 11 files changed, 119 insertions(+), 59 deletions(-) delete mode 100644 changelog/5089.bugfix.rst delete mode 100644 changelog/5139.bugfix.rst delete mode 100644 changelog/5171.doc.rst delete mode 100644 changelog/5182.trivial.rst delete mode 100644 changelog/5188.doc.rst delete mode 100644 changelog/5229.bugfix.rst create mode 100644 doc/en/announce/release-4.4.2.rst diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 4408c7340..e035a1a4d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -18,6 +18,39 @@ with advance notice in the **Deprecations** section of releases. .. towncrier release notes start +pytest 4.4.2 (2019-05-08) +========================= + +Bug Fixes +--------- + +- `#5089 `_: Fix crash caused by error in ``__repr__`` function with both ``showlocals`` and verbose output enabled. + + +- `#5139 `_: Eliminate core dependency on 'terminal' plugin. + + +- `#5229 `_: Require ``pluggy>=0.11.0`` which reverts a dependency to ``importlib-metadata`` added in ``0.10.0``. + The ``importlib-metadata`` package cannot be imported when installed as an egg and causes issues when relying on ``setup.py`` to install test dependencies. + + + +Improved Documentation +---------------------- + +- `#5171 `_: Doc: ``pytest_ignore_collect``, ``pytest_collect_directory``, ``pytest_collect_file`` and ``pytest_pycollect_makemodule`` hooks's 'path' parameter documented type is now ``py.path.local`` + + +- `#5188 `_: Improve help for ``--runxfail`` flag. + + + +Trivial/Internal Changes +------------------------ + +- `#5182 `_: Removed internal and unused ``_pytest.deprecated.MARK_INFO_ATTRIBUTE``. + + pytest 4.4.1 (2019-04-15) ========================= diff --git a/changelog/5089.bugfix.rst b/changelog/5089.bugfix.rst deleted file mode 100644 index 7be7fc7e5..000000000 --- a/changelog/5089.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix crash caused by error in ``__repr__`` function with both ``showlocals`` and verbose output enabled. diff --git a/changelog/5139.bugfix.rst b/changelog/5139.bugfix.rst deleted file mode 100644 index 1369d3b75..000000000 --- a/changelog/5139.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Eliminate core dependency on 'terminal' plugin. diff --git a/changelog/5171.doc.rst b/changelog/5171.doc.rst deleted file mode 100644 index 7cdbad0f5..000000000 --- a/changelog/5171.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Doc: ``pytest_ignore_collect``, ``pytest_collect_directory``, ``pytest_collect_file`` and ``pytest_pycollect_makemodule`` hooks's 'path' parameter documented type is now ``py.path.local`` diff --git a/changelog/5182.trivial.rst b/changelog/5182.trivial.rst deleted file mode 100644 index 24bd9bd86..000000000 --- a/changelog/5182.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -Removed internal and unused ``_pytest.deprecated.MARK_INFO_ATTRIBUTE``. diff --git a/changelog/5188.doc.rst b/changelog/5188.doc.rst deleted file mode 100644 index 726745638..000000000 --- a/changelog/5188.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Improve help for ``--runxfail`` flag. diff --git a/changelog/5229.bugfix.rst b/changelog/5229.bugfix.rst deleted file mode 100644 index 948ac6509..000000000 --- a/changelog/5229.bugfix.rst +++ /dev/null @@ -1,2 +0,0 @@ -Require ``pluggy>=0.11.0`` which reverts a dependency to ``importlib-metadata`` added in ``0.10.0``. -The ``importlib-metadata`` package cannot be imported when installed as an egg and causes issues when relying on ``setup.py`` to install test dependencies. diff --git a/doc/en/announce/index.rst b/doc/en/announce/index.rst index c467535bd..179e40abe 100644 --- a/doc/en/announce/index.rst +++ b/doc/en/announce/index.rst @@ -6,6 +6,7 @@ Release announcements :maxdepth: 2 + release-4.4.2 release-4.4.1 release-4.4.0 release-4.3.1 diff --git a/doc/en/announce/release-4.4.2.rst b/doc/en/announce/release-4.4.2.rst new file mode 100644 index 000000000..4fe2dac56 --- /dev/null +++ b/doc/en/announce/release-4.4.2.rst @@ -0,0 +1,33 @@ +pytest-4.4.2 +======================================= + +pytest 4.4.2 has just been released to PyPI. + +This is a bug-fix release, being a drop-in replacement. To upgrade:: + + pip install --upgrade pytest + +The full changelog is available at https://docs.pytest.org/en/latest/changelog.html. + +Thanks to all who contributed to this release, among them: + +* Allan Lewis +* Anthony Sottile +* Bruno Oliveira +* DamianSkrzypczak +* Daniel Hahler +* Don Kirkby +* Douglas Thor +* Hugo +* Ilya Konstantinov +* Jon Dufresne +* Matt Cooper +* Nikolay Kondratyev +* Ondřej Súkup +* Peter Schutt +* Romain Chossart +* Sitaktif + + +Happy testing, +The pytest Development Team diff --git a/doc/en/example/reportingdemo.rst b/doc/en/example/reportingdemo.rst index 824e8398f..f6c417d7a 100644 --- a/doc/en/example/reportingdemo.rst +++ b/doc/en/example/reportingdemo.rst @@ -26,7 +26,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: > assert param1 * 2 < param2 E assert (3 * 2) < 6 - failure_demo.py:22: AssertionError + failure_demo.py:20: AssertionError _________________________ TestFailing.test_simple __________________________ self = @@ -43,7 +43,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: E + where 42 = .f at 0xdeadbeef>() E + and 43 = .g at 0xdeadbeef>() - failure_demo.py:33: AssertionError + failure_demo.py:31: AssertionError ____________________ TestFailing.test_simple_multiline _____________________ self = @@ -51,7 +51,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: def test_simple_multiline(self): > otherfunc_multi(42, 6 * 9) - failure_demo.py:36: + failure_demo.py:34: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ a = 42, b = 54 @@ -60,7 +60,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: > assert a == b E assert 42 == 54 - failure_demo.py:17: AssertionError + failure_demo.py:15: AssertionError ___________________________ TestFailing.test_not ___________________________ self = @@ -73,7 +73,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: E assert not 42 E + where 42 = .f at 0xdeadbeef>() - failure_demo.py:42: AssertionError + failure_demo.py:40: AssertionError _________________ TestSpecialisedExplanations.test_eq_text _________________ self = @@ -84,7 +84,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: E - spam E + eggs - failure_demo.py:47: AssertionError + failure_demo.py:45: AssertionError _____________ TestSpecialisedExplanations.test_eq_similar_text _____________ self = @@ -97,7 +97,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: E + foo 2 bar E ? ^ - failure_demo.py:50: AssertionError + failure_demo.py:48: AssertionError ____________ TestSpecialisedExplanations.test_eq_multiline_text ____________ self = @@ -110,7 +110,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: E + eggs E bar - failure_demo.py:53: AssertionError + failure_demo.py:51: AssertionError ______________ TestSpecialisedExplanations.test_eq_long_text _______________ self = @@ -127,7 +127,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: E + 1111111111b222222222 E ? ^ - failure_demo.py:58: AssertionError + failure_demo.py:56: AssertionError _________ TestSpecialisedExplanations.test_eq_long_text_multiline __________ self = @@ -147,7 +147,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: E E ...Full output truncated (7 lines hidden), use '-vv' to show - failure_demo.py:63: AssertionError + failure_demo.py:61: AssertionError _________________ TestSpecialisedExplanations.test_eq_list _________________ self = @@ -158,7 +158,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: E At index 2 diff: 2 != 3 E Use -v to get the full diff - failure_demo.py:66: AssertionError + failure_demo.py:64: AssertionError ______________ TestSpecialisedExplanations.test_eq_list_long _______________ self = @@ -171,7 +171,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: E At index 100 diff: 1 != 2 E Use -v to get the full diff - failure_demo.py:71: AssertionError + failure_demo.py:69: AssertionError _________________ TestSpecialisedExplanations.test_eq_dict _________________ self = @@ -189,7 +189,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: E E ...Full output truncated (2 lines hidden), use '-vv' to show - failure_demo.py:74: AssertionError + failure_demo.py:72: AssertionError _________________ TestSpecialisedExplanations.test_eq_set __________________ self = @@ -207,7 +207,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: E E ...Full output truncated (2 lines hidden), use '-vv' to show - failure_demo.py:77: AssertionError + failure_demo.py:75: AssertionError _____________ TestSpecialisedExplanations.test_eq_longer_list ______________ self = @@ -218,7 +218,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: E Right contains more items, first extra item: 3 E Use -v to get the full diff - failure_demo.py:80: AssertionError + failure_demo.py:78: AssertionError _________________ TestSpecialisedExplanations.test_in_list _________________ self = @@ -227,7 +227,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: > assert 1 in [0, 2, 3, 4, 5] E assert 1 in [0, 2, 3, 4, 5] - failure_demo.py:83: AssertionError + failure_demo.py:81: AssertionError __________ TestSpecialisedExplanations.test_not_in_text_multiline __________ self = @@ -246,7 +246,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: E E ...Full output truncated (2 lines hidden), use '-vv' to show - failure_demo.py:87: AssertionError + failure_demo.py:85: AssertionError ___________ TestSpecialisedExplanations.test_not_in_text_single ____________ self = @@ -259,7 +259,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: E single foo line E ? +++ - failure_demo.py:91: AssertionError + failure_demo.py:89: AssertionError _________ TestSpecialisedExplanations.test_not_in_text_single_long _________ self = @@ -272,7 +272,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: E head head foo tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail E ? +++ - failure_demo.py:95: AssertionError + failure_demo.py:93: AssertionError ______ TestSpecialisedExplanations.test_not_in_text_single_long_term _______ self = @@ -285,7 +285,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: E head head fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffftail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail E ? ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - failure_demo.py:99: AssertionError + failure_demo.py:97: AssertionError ______________ TestSpecialisedExplanations.test_eq_dataclass _______________ self = @@ -306,7 +306,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: E Differing attributes: E b: 'b' != 'c' - failure_demo.py:111: AssertionError + failure_demo.py:109: AssertionError ________________ TestSpecialisedExplanations.test_eq_attrs _________________ self = @@ -327,7 +327,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: E Differing attributes: E b: 'b' != 'c' - failure_demo.py:123: AssertionError + failure_demo.py:121: AssertionError ______________________________ test_attribute ______________________________ def test_attribute(): @@ -339,7 +339,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: E assert 1 == 2 E + where 1 = .Foo object at 0xdeadbeef>.b - failure_demo.py:131: AssertionError + failure_demo.py:129: AssertionError _________________________ test_attribute_instance __________________________ def test_attribute_instance(): @@ -351,7 +351,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: E + where 1 = .Foo object at 0xdeadbeef>.b E + where .Foo object at 0xdeadbeef> = .Foo'>() - failure_demo.py:138: AssertionError + failure_demo.py:136: AssertionError __________________________ test_attribute_failure __________________________ def test_attribute_failure(): @@ -364,7 +364,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: i = Foo() > assert i.b == 2 - failure_demo.py:149: + failure_demo.py:147: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .Foo object at 0xdeadbeef> @@ -373,7 +373,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: > raise Exception("Failed to get attrib") E Exception: Failed to get attrib - failure_demo.py:144: Exception + failure_demo.py:142: Exception _________________________ test_attribute_multiple __________________________ def test_attribute_multiple(): @@ -390,7 +390,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: E + and 2 = .Bar object at 0xdeadbeef>.b E + where .Bar object at 0xdeadbeef> = .Bar'>() - failure_demo.py:159: AssertionError + failure_demo.py:157: AssertionError __________________________ TestRaises.test_raises __________________________ self = @@ -400,7 +400,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: > raises(TypeError, int, s) E ValueError: invalid literal for int() with base 10: 'qwe' - failure_demo.py:169: ValueError + failure_demo.py:167: ValueError ______________________ TestRaises.test_raises_doesnt _______________________ self = @@ -409,7 +409,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: > raises(IOError, int, "3") E Failed: DID NOT RAISE - failure_demo.py:172: Failed + failure_demo.py:170: Failed __________________________ TestRaises.test_raise ___________________________ self = @@ -418,7 +418,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: > raise ValueError("demo error") E ValueError: demo error - failure_demo.py:175: ValueError + failure_demo.py:173: ValueError ________________________ TestRaises.test_tupleerror ________________________ self = @@ -427,7 +427,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: > a, b = [1] # NOQA E ValueError: not enough values to unpack (expected 2, got 1) - failure_demo.py:178: ValueError + failure_demo.py:176: ValueError ______ TestRaises.test_reinterpret_fails_with_print_for_the_fun_of_it ______ self = @@ -438,7 +438,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: > a, b = items.pop() E TypeError: 'int' object is not iterable - failure_demo.py:183: TypeError + failure_demo.py:181: TypeError --------------------------- Captured stdout call --------------------------- items is [1, 2, 3] ________________________ TestRaises.test_some_error ________________________ @@ -449,7 +449,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: > if namenotexi: # NOQA E NameError: name 'namenotexi' is not defined - failure_demo.py:186: NameError + failure_demo.py:184: NameError ____________________ test_dynamic_compile_shows_nicely _____________________ def test_dynamic_compile_shows_nicely(): @@ -464,14 +464,14 @@ Here is a nice run of several failures and how ``pytest`` presents things: sys.modules[name] = module > module.foo() - failure_demo.py:204: + failure_demo.py:202: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ def foo(): > assert 1 == 0 E AssertionError - <0-codegen 'abc-123' $REGENDOC_TMPDIR/assertion/failure_demo.py:201>:2: AssertionError + <0-codegen 'abc-123' $REGENDOC_TMPDIR/assertion/failure_demo.py:199>:2: AssertionError ____________________ TestMoreErrors.test_complex_error _____________________ self = @@ -485,9 +485,9 @@ Here is a nice run of several failures and how ``pytest`` presents things: > somefunc(f(), g()) - failure_demo.py:215: + failure_demo.py:213: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ - failure_demo.py:13: in somefunc + failure_demo.py:11: in somefunc otherfunc(x, y) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ @@ -497,7 +497,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: > assert a == b E assert 44 == 43 - failure_demo.py:9: AssertionError + failure_demo.py:7: AssertionError ___________________ TestMoreErrors.test_z1_unpack_error ____________________ self = @@ -507,7 +507,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: > a, b = items E ValueError: not enough values to unpack (expected 2, got 0) - failure_demo.py:219: ValueError + failure_demo.py:217: ValueError ____________________ TestMoreErrors.test_z2_type_error _____________________ self = @@ -517,7 +517,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: > a, b = items E TypeError: 'int' object is not iterable - failure_demo.py:223: TypeError + failure_demo.py:221: TypeError ______________________ TestMoreErrors.test_startswith ______________________ self = @@ -530,7 +530,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: E + where False = ('456') E + where = '123'.startswith - failure_demo.py:228: AssertionError + failure_demo.py:226: AssertionError __________________ TestMoreErrors.test_startswith_nested ___________________ self = @@ -549,7 +549,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: E + where '123' = .f at 0xdeadbeef>() E + and '456' = .g at 0xdeadbeef>() - failure_demo.py:237: AssertionError + failure_demo.py:235: AssertionError _____________________ TestMoreErrors.test_global_func ______________________ self = @@ -560,7 +560,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: E + where False = isinstance(43, float) E + where 43 = globf(42) - failure_demo.py:240: AssertionError + failure_demo.py:238: AssertionError _______________________ TestMoreErrors.test_instance _______________________ self = @@ -571,7 +571,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: E assert 42 != 42 E + where 42 = .x - failure_demo.py:244: AssertionError + failure_demo.py:242: AssertionError _______________________ TestMoreErrors.test_compare ________________________ self = @@ -581,7 +581,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: E assert 11 < 5 E + where 11 = globf(10) - failure_demo.py:247: AssertionError + failure_demo.py:245: AssertionError _____________________ TestMoreErrors.test_try_finally ______________________ self = @@ -592,7 +592,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: > assert x == 0 E assert 1 == 0 - failure_demo.py:252: AssertionError + failure_demo.py:250: AssertionError ___________________ TestCustomAssertMsg.test_single_line ___________________ self = @@ -607,7 +607,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: E assert 1 == 2 E + where 1 = .A'>.a - failure_demo.py:263: AssertionError + failure_demo.py:261: AssertionError ____________________ TestCustomAssertMsg.test_multiline ____________________ self = @@ -626,7 +626,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: E assert 1 == 2 E + where 1 = .A'>.a - failure_demo.py:270: AssertionError + failure_demo.py:268: AssertionError ___________________ TestCustomAssertMsg.test_custom_repr ___________________ self = @@ -648,5 +648,5 @@ Here is a nice run of several failures and how ``pytest`` presents things: E assert 1 == 2 E + where 1 = This is JSON\n{\n 'foo': 'bar'\n}.a - failure_demo.py:283: AssertionError + failure_demo.py:281: AssertionError ======================== 44 failed in 0.12 seconds ========================= diff --git a/doc/en/usage.rst b/doc/en/usage.rst index ffd37aab3..b44dcbb01 100644 --- a/doc/en/usage.rst +++ b/doc/en/usage.rst @@ -233,7 +233,7 @@ Example: XPASS test_example.py::test_xpass always xfail ERROR test_example.py::test_error FAILED test_example.py::test_fail - 1 failed, 1 passed, 1 skipped, 1 xfailed, 1 xpassed, 1 error in 0.12 seconds + = 1 failed, 1 passed, 1 skipped, 1 xfailed, 1 xpassed, 1 error in 0.12 seconds = The ``-r`` options accepts a number of characters after it, with ``a`` used above meaning "all except passes". @@ -281,7 +281,7 @@ More than one character can be used, so for example to only see failed and skipp ========================= short test summary info ========================== FAILED test_example.py::test_fail SKIPPED [1] $REGENDOC_TMPDIR/test_example.py:23: skipping this test - 1 failed, 1 passed, 1 skipped, 1 xfailed, 1 xpassed, 1 error in 0.12 seconds + = 1 failed, 1 passed, 1 skipped, 1 xfailed, 1 xpassed, 1 error in 0.12 seconds = Using ``p`` lists the passing tests, whilst ``P`` adds an extra section "PASSES" with those tests that passed but had captured output: @@ -320,7 +320,7 @@ captured output: _________________________________ test_ok __________________________________ --------------------------- Captured stdout call --------------------------- ok - 1 failed, 1 passed, 1 skipped, 1 xfailed, 1 xpassed, 1 error in 0.12 seconds + = 1 failed, 1 passed, 1 skipped, 1 xfailed, 1 xpassed, 1 error in 0.12 seconds = .. _pdb-option: From e1756fc631eed1e4ecb9904eca83e0b5903694de Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Thu, 9 May 2019 08:47:01 -0300 Subject: [PATCH 13/14] Pin pluggy to <1.0 Make sure we don't update to pluggy 1.0 automatically, as there are planned breaking changes in the 1.0 release. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 08c559c93..1a7184cc3 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ INSTALL_REQUIRES = [ 'funcsigs>=1.0;python_version<"3.0"', 'pathlib2>=2.2.0;python_version<"3.6"', 'colorama;sys_platform=="win32"', - "pluggy>=0.11", + "pluggy>=0.9,!=0.10,<1.0", ] From 4d782dc13fab89d660337b4152c9dd5ca9b14d20 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Thu, 9 May 2019 09:00:39 -0300 Subject: [PATCH 14/14] Add CHANGELOG for #5239 --- changelog/5239.trivial.rst | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changelog/5239.trivial.rst diff --git a/changelog/5239.trivial.rst b/changelog/5239.trivial.rst new file mode 100644 index 000000000..5bd7389f3 --- /dev/null +++ b/changelog/5239.trivial.rst @@ -0,0 +1,3 @@ +Pin ``pluggy`` to ``< 1.0`` so we don't update to ``1.0`` automatically when +it gets released: there are planned breaking changes, and we want to ensure +pytest properly supports ``pluggy 1.0``.