From f99da9058f8569f8186515ba8d550fc7f019f5c1 Mon Sep 17 00:00:00 2001 From: Ammar Najjar Date: Thu, 17 May 2018 22:49:44 +0200 Subject: [PATCH 01/17] Issue #3295: Correct the usage of --last-failed-no-failures documentation - add the missing --last-failed argument in the presented examples, for they are missleading and lead to think that the missing argument is not needed. --- doc/en/cache.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/en/cache.rst b/doc/en/cache.rst index 57a091116..184c0607c 100644 --- a/doc/en/cache.rst +++ b/doc/en/cache.rst @@ -162,8 +162,8 @@ When no tests failed in the last run, or when no cached ``lastfailed`` data was found, ``pytest`` can be configured either to run all of the tests or no tests, using the ``--last-failed-no-failures`` option, which takes one of the following values:: - pytest --last-failed-no-failures all # run all tests (default behavior) - pytest --last-failed-no-failures none # run no tests and exit + pytest --last-failed --last-failed-no-failures all # run all tests (default behavior) + pytest --last-failed --last-failed-no-failures none # run no tests and exit The new config.cache object -------------------------------- From 9ddd5737743150d07b51fd354f441ec441409b68 Mon Sep 17 00:00:00 2001 From: Ammar Najjar Date: Thu, 17 May 2018 23:11:37 +0200 Subject: [PATCH 02/17] Issue #3295: add changelog doc entry for adding a missing argument in the examples --- changelog/3295.doc.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog/3295.doc.rst diff --git a/changelog/3295.doc.rst b/changelog/3295.doc.rst new file mode 100644 index 000000000..c4e351efb --- /dev/null +++ b/changelog/3295.doc.rst @@ -0,0 +1 @@ +Correct the usage documentation of ``--last-failed-no-failures`` by adding the missing ``--last-failed`` argument in the presented examples, for they are missleading and lead to think that the missing argument is not needed. From 7bff5866b1dd7992d9bdcdce1bac41fe043760c1 Mon Sep 17 00:00:00 2001 From: Alan Date: Wed, 18 Jul 2018 17:29:55 -0400 Subject: [PATCH 03/17] bugfix in ApproxNumpy initialisation, use keywords for arguments now --- src/_pytest/python_api.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/_pytest/python_api.py b/src/_pytest/python_api.py index d88d1c88b..f35351e2a 100644 --- a/src/_pytest/python_api.py +++ b/src/_pytest/python_api.py @@ -211,7 +211,10 @@ class ApproxScalar(ApproxBase): the pre-specified tolerance. """ if _is_numpy_array(actual): - return ApproxNumpy(actual, self.abs, self.rel, self.nan_ok) == self.expected + return ( + ApproxNumpy(actual, rel=self.rel, abs=self.abs, nan_ok=self.nan_ok) + == self.expected + ) # Short-circuit exact equality. if actual == self.expected: From 75db6084792c3b33c56b57c1a5c5e7ea612f84da Mon Sep 17 00:00:00 2001 From: Alan Brammer Date: Wed, 18 Jul 2018 17:56:00 -0400 Subject: [PATCH 04/17] update changelog --- changelog/3695.bugfix.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog/3695.bugfix.rst diff --git a/changelog/3695.bugfix.rst b/changelog/3695.bugfix.rst new file mode 100644 index 000000000..e9e258fd4 --- /dev/null +++ b/changelog/3695.bugfix.rst @@ -0,0 +1 @@ +Fix ApproxNumpy initialisation argument mixup. abs rel tolerances were previously flipped From 514ca6f4adcfe24efd0f221d7d00220275446f76 Mon Sep 17 00:00:00 2001 From: abrammer Date: Mon, 23 Jul 2018 23:40:06 -0400 Subject: [PATCH 05/17] add test wrt #3695 checking numpy array tolerance args --- testing/python/approx.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/testing/python/approx.py b/testing/python/approx.py index 39f10a821..b93ff241b 100644 --- a/testing/python/approx.py +++ b/testing/python/approx.py @@ -342,6 +342,20 @@ class TestApprox(object): assert actual == approx(list(expected), rel=5e-7, abs=0) assert actual != approx(list(expected), rel=5e-8, abs=0) + def test_numpy_tolerance_args(self): + """ + quick check that numpy rel/abs args are handled correctly + for comparison against an np.array + """ + np = pytest.importorskip("numpy") + expected = 100 + actual = 99 + assert actual != pytest.approx(expected, abs=0.1, rel=0) + assert np.array(actual) != pytest.approx(expected, abs=0.1, rel=0) + + assert actual == pytest.approx(expected, abs=0, rel=0.01) + assert np.array(actual) == pytest.approx(expected, abs=0, rel=0.1) + def test_numpy_array_wrong_shape(self): np = pytest.importorskip("numpy") From f0db64ac2e1ba54281c62049f191f1bb2c3565e7 Mon Sep 17 00:00:00 2001 From: abrammer Date: Tue, 24 Jul 2018 21:18:44 -0400 Subject: [PATCH 06/17] drop the duplicate approx call update test to include both np.array(actual) and np.array(expected) --- src/_pytest/python_api.py | 7 +++---- testing/python/approx.py | 9 ++++++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/_pytest/python_api.py b/src/_pytest/python_api.py index f35351e2a..04022b9fe 100644 --- a/src/_pytest/python_api.py +++ b/src/_pytest/python_api.py @@ -211,10 +211,9 @@ class ApproxScalar(ApproxBase): the pre-specified tolerance. """ if _is_numpy_array(actual): - return ( - ApproxNumpy(actual, rel=self.rel, abs=self.abs, nan_ok=self.nan_ok) - == self.expected - ) + import numpy as np + + return np.all(abs(self.expected - actual) <= self.tolerance) # Short-circuit exact equality. if actual == self.expected: diff --git a/testing/python/approx.py b/testing/python/approx.py index b93ff241b..09487cc73 100644 --- a/testing/python/approx.py +++ b/testing/python/approx.py @@ -346,15 +346,22 @@ class TestApprox(object): """ quick check that numpy rel/abs args are handled correctly for comparison against an np.array + - 3.6.4 would approx both actual / expected if np.array + regardless of which value was passed to approx() + Means tolerance could be calculated against bad test return """ np = pytest.importorskip("numpy") expected = 100 actual = 99 assert actual != pytest.approx(expected, abs=0.1, rel=0) assert np.array(actual) != pytest.approx(expected, abs=0.1, rel=0) + assert actual != pytest.approx(np.array(expected), abs=0.1, rel=0) + assert np.array(actual) != pytest.approx(np.array(expected), abs=0.1, rel=0) assert actual == pytest.approx(expected, abs=0, rel=0.01) - assert np.array(actual) == pytest.approx(expected, abs=0, rel=0.1) + assert np.array(actual) == pytest.approx(expected, abs=0, rel=0.01) + assert actual == pytest.approx(np.array(expected), abs=0, rel=0.01) + assert np.array(actual) == pytest.approx(np.array(expected), abs=0, rel=0.01) def test_numpy_array_wrong_shape(self): np = pytest.importorskip("numpy") From 2eb9301ad553961bd4a4a48519df867879a03f35 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 25 Jul 2018 08:09:31 -0300 Subject: [PATCH 07/17] Improve CHANGELOG --- changelog/3695.bugfix.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog/3695.bugfix.rst b/changelog/3695.bugfix.rst index e9e258fd4..a6a15b697 100644 --- a/changelog/3695.bugfix.rst +++ b/changelog/3695.bugfix.rst @@ -1 +1 @@ -Fix ApproxNumpy initialisation argument mixup. abs rel tolerances were previously flipped +Fix ``ApproxNumpy`` initialisation argument mixup, ``abs`` and ``rel`` tolerances were flipped causing strange comparsion results. From d0ba242c46f2b4b08d7a02d302883b07906dcd08 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Fri, 27 Jul 2018 15:07:20 -0300 Subject: [PATCH 08/17] Implement change suggested by @kalekundert in PR --- src/_pytest/python_api.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/_pytest/python_api.py b/src/_pytest/python_api.py index 04022b9fe..6d2828a64 100644 --- a/src/_pytest/python_api.py +++ b/src/_pytest/python_api.py @@ -211,9 +211,7 @@ class ApproxScalar(ApproxBase): the pre-specified tolerance. """ if _is_numpy_array(actual): - import numpy as np - - return np.all(abs(self.expected - actual) <= self.tolerance) + return all(a == self for a in actual) # Short-circuit exact equality. if actual == self.expected: From bf127a63b2583b2c899fcaa4a38061e590711e21 Mon Sep 17 00:00:00 2001 From: Kale Kundert Date: Fri, 27 Jul 2018 11:24:42 -0700 Subject: [PATCH 09/17] Need to iterate over the flattened array. --- 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 6d2828a64..5331d8a84 100644 --- a/src/_pytest/python_api.py +++ b/src/_pytest/python_api.py @@ -211,7 +211,7 @@ class ApproxScalar(ApproxBase): the pre-specified tolerance. """ if _is_numpy_array(actual): - return all(a == self for a in actual) + return all(a == self for a in actual.flat) # Short-circuit exact equality. if actual == self.expected: From c480223e88d8aa63c384489fe55afb46e7a57c91 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Sun, 29 Jul 2018 19:53:49 -0300 Subject: [PATCH 10/17] Test with Python 3.7 on Travis and AppVeyor --- .travis.yml | 4 +++- appveyor.yml | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 28393a0b7..7882c300e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,7 +41,9 @@ jobs: - env: TOXENV=py36-freeze python: '3.6' - env: TOXENV=py37 - python: 'nightly' + python: 3.7 + sudo: required + dist: xenial - stage: deploy python: '3.6' diff --git a/appveyor.yml b/appveyor.yml index 339611e72..11e57f0c8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -14,6 +14,7 @@ environment: - TOXENV: "py34" - TOXENV: "py35" - TOXENV: "py36" + - TOXENV: "py37" - TOXENV: "pypy" - TOXENV: "py27-pexpect" - TOXENV: "py27-xdist" From 330640eb96bb70d9c7ce01841b22a87904cdc703 Mon Sep 17 00:00:00 2001 From: abrammer Date: Sun, 29 Jul 2018 22:47:38 -0400 Subject: [PATCH 11/17] update tests to check tolerance args and expecing nan in numpy arrays --- testing/python/approx.py | 55 ++++++++++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 14 deletions(-) diff --git a/testing/python/approx.py b/testing/python/approx.py index 09487cc73..130547704 100644 --- a/testing/python/approx.py +++ b/testing/python/approx.py @@ -344,24 +344,51 @@ class TestApprox(object): def test_numpy_tolerance_args(self): """ - quick check that numpy rel/abs args are handled correctly + Check that numpy rel/abs args are handled correctly for comparison against an np.array - - 3.6.4 would approx both actual / expected if np.array - regardless of which value was passed to approx() - Means tolerance could be calculated against bad test return + Check both sides of the operator, hopefully it doesn't impact things. + Test all permutations of where the approx and np.array() can show up """ np = pytest.importorskip("numpy") - expected = 100 - actual = 99 - assert actual != pytest.approx(expected, abs=0.1, rel=0) - assert np.array(actual) != pytest.approx(expected, abs=0.1, rel=0) - assert actual != pytest.approx(np.array(expected), abs=0.1, rel=0) - assert np.array(actual) != pytest.approx(np.array(expected), abs=0.1, rel=0) + expected = 100. + actual = 99. + abs_diff = expected - actual + rel_diff = (expected - actual) / expected - assert actual == pytest.approx(expected, abs=0, rel=0.01) - assert np.array(actual) == pytest.approx(expected, abs=0, rel=0.01) - assert actual == pytest.approx(np.array(expected), abs=0, rel=0.01) - assert np.array(actual) == pytest.approx(np.array(expected), abs=0, rel=0.01) + tests = [ + (eq, abs_diff, 0), + (eq, 0, rel_diff), + (ne, 0, rel_diff / 2.), # rel diff fail + (ne, abs_diff / 2., 0), # abs diff fail + ] + + for op, _abs, _rel in tests: + assert op(np.array(actual), approx(expected, abs=_abs, rel=_rel)) # a, b + assert op(approx(expected, abs=_abs, rel=_rel), np.array(actual)) # b, a + + assert op(actual, approx(np.array(expected), abs=_abs, rel=_rel)) # a, b + assert op(approx(np.array(expected), abs=_abs, rel=_rel), actual) # b, a + + assert op(np.array(actual), approx(np.array(expected), abs=_abs, rel=_rel)) + assert op(approx(np.array(expected), abs=_abs, rel=_rel), np.array(actual)) + + def test_numpy_expecting_nan(self): + np = pytest.importorskip("numpy") + examples = [ + (eq, nan, nan), + (eq, -nan, -nan), + (eq, nan, -nan), + (ne, 0.0, nan), + (ne, inf, nan), + ] + for op, a, x in examples: + # Nothing is equal to NaN by default. + assert np.array(a) != approx(x) + assert a != approx(np.array(x)) + + # If ``nan_ok=True``, then NaN is equal to NaN. + assert op(np.array(a), approx(x, nan_ok=True)) + assert op(a, approx(np.array(x), nan_ok=True)) def test_numpy_array_wrong_shape(self): np = pytest.importorskip("numpy") From 762eaf443a72b4345bfd08cc423d3cf5c0a90224 Mon Sep 17 00:00:00 2001 From: abrammer Date: Sun, 29 Jul 2018 22:57:39 -0400 Subject: [PATCH 12/17] update changelog to include the addition of tests --- changelog/3695.bugfix.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog/3695.bugfix.rst b/changelog/3695.bugfix.rst index a6a15b697..42d07336b 100644 --- a/changelog/3695.bugfix.rst +++ b/changelog/3695.bugfix.rst @@ -1 +1,2 @@ Fix ``ApproxNumpy`` initialisation argument mixup, ``abs`` and ``rel`` tolerances were flipped causing strange comparsion results. +Add tests to check ``abs`` and ``rel`` tolerances for ``np.array`` and test for expecting ``nan`` with ``np.array()`` From 535fd1f3117e0f7d72abc80bfe1faef7033146b5 Mon Sep 17 00:00:00 2001 From: abrammer Date: Sun, 29 Jul 2018 23:12:04 -0400 Subject: [PATCH 13/17] may as well include inf test while we're at it --- testing/python/approx.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/testing/python/approx.py b/testing/python/approx.py index 130547704..0509fa672 100644 --- a/testing/python/approx.py +++ b/testing/python/approx.py @@ -390,6 +390,20 @@ class TestApprox(object): assert op(np.array(a), approx(x, nan_ok=True)) assert op(a, approx(np.array(x), nan_ok=True)) + def test_numpy_expecting_inf(self): + np = pytest.importorskip("numpy") + examples = [ + (eq, inf, inf), + (eq, -inf, -inf), + (ne, inf, -inf), + (ne, 0.0, inf), + (ne, nan, inf), + ] + for op, a, x in examples: + assert op(np.array(a), approx(x)) + assert op(a, approx(np.array(x))) + assert op(np.array(a), approx(np.array(x))) + def test_numpy_array_wrong_shape(self): np = pytest.importorskip("numpy") From d461e931dd7fa7eae7b835cb84047e033872aade Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Mon, 30 Jul 2018 19:40:32 +0000 Subject: [PATCH 14/17] Use python 3.6 for regendoc --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 304cc973d..a126dbbf1 100644 --- a/tox.ini +++ b/tox.ini @@ -139,7 +139,7 @@ commands = [testenv:regen] changedir = doc/en skipsdist = True -basepython = python3.5 +basepython = python3.6 deps = sphinx PyYAML From 2c09930b6d701d91a0284c6d44086488ffbcb419 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Mon, 30 Jul 2018 20:13:17 +0000 Subject: [PATCH 15/17] Use proper quotes for python 3.7 on travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7882c300e..bb80ddd74 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,7 +41,7 @@ jobs: - env: TOXENV=py36-freeze python: '3.6' - env: TOXENV=py37 - python: 3.7 + python: '3.7' sudo: required dist: xenial From 60b1913ba21094da5eb91d8c68642c38f20f6a26 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Mon, 30 Jul 2018 20:14:42 +0000 Subject: [PATCH 16/17] Preparing release version 3.7.0 --- CHANGELOG.rst | 64 +++++++++++++++++++++++++++++++ changelog/2220.bugfix.rst | 1 - changelog/2283.feature | 1 - changelog/2639.removal.rst | 4 -- changelog/3295.doc.rst | 1 - changelog/3519.trivial.rst | 1 - changelog/3576.feature.rst | 1 - changelog/3579.feature.rst | 1 - changelog/3610.feature.rst | 1 - changelog/3623.feature.rst | 1 - changelog/3661.removal.rst | 3 -- changelog/3695.bugfix.rst | 2 - changelog/980.bugfix.rst | 1 - doc/en/announce/index.rst | 1 + doc/en/announce/release-3.7.0.rst | 41 ++++++++++++++++++++ doc/en/example/markers.rst | 16 ++++---- doc/en/example/nonpython.rst | 9 +++-- doc/en/example/reportingdemo.rst | 2 +- doc/en/example/simple.rst | 2 +- doc/en/fixture.rst | 6 +-- doc/en/getting-started.rst | 2 +- 21 files changed, 125 insertions(+), 36 deletions(-) delete mode 100644 changelog/2220.bugfix.rst delete mode 100644 changelog/2283.feature delete mode 100644 changelog/2639.removal.rst delete mode 100644 changelog/3295.doc.rst delete mode 100644 changelog/3519.trivial.rst delete mode 100644 changelog/3576.feature.rst delete mode 100644 changelog/3579.feature.rst delete mode 100644 changelog/3610.feature.rst delete mode 100644 changelog/3623.feature.rst delete mode 100644 changelog/3661.removal.rst delete mode 100644 changelog/3695.bugfix.rst delete mode 100644 changelog/980.bugfix.rst create mode 100644 doc/en/announce/release-3.7.0.rst diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a6aa836df..31d14ebe3 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -8,6 +8,70 @@ .. towncrier release notes start +pytest 3.7.0 (2018-07-30) +========================= + +Deprecations and Removals +------------------------- + +- `#2639 `_: ``pytest_namespace`` has been deprecated. + + See the documentation for ``pytest_namespace`` hook for suggestions on how to deal + with this in plugins which use this functionality. + + +- `#3661 `_: Calling a fixture function directly, as opposed to request them in a test function, now issues a ``RemovedInPytest4Warning``. It will be changed into an error in pytest ``4.0``. + + This is a great source of confusion to new users, which will often call the fixture functions and request them from test functions interchangeably, which breaks the fixture resolution model. + + + +Features +-------- + +- `#2283 `_: New ``package`` fixture scope: fixtures are finalized when the last test of a *package* finishes. This feature is considered **experimental**, so use it sparingly. + + +- `#3576 `_: ``Node.add_marker`` now supports an ``append=True/False`` parameter to determine whether the mark comes last (default) or first. + + +- `#3579 `_: Fixture ``caplog`` now has a ``messages`` property, providing convenient access to the format-interpolated log messages without the extra data provided by the formatter/handler. + + +- `#3610 `_: New ``--trace`` option to enter the debugger at the start of a test. + + +- `#3623 `_: Introduce ``pytester.copy_example`` as helper to do acceptance tests against examples from the project. + + + +Bug Fixes +--------- + +- `#2220 `_: Fix a bug where fixtures overriden by direct parameters (for example parametrization) were being instantiated even if they were not being used by a test. + + +- `#3695 `_: Fix ``ApproxNumpy`` initialisation argument mixup, ``abs`` and ``rel`` tolerances were flipped causing strange comparsion results. + Add tests to check ``abs`` and ``rel`` tolerances for ``np.array`` and test for expecting ``nan`` with ``np.array()`` + + +- `#980 `_: Fix truncated locals output in verbose mode. + + + +Improved Documentation +---------------------- + +- `#3295 `_: Correct the usage documentation of ``--last-failed-no-failures`` by adding the missing ``--last-failed`` argument in the presented examples, for they are missleading and lead to think that the missing argument is not needed. + + + +Trivial/Internal Changes +------------------------ + +- `#3519 `_: Now a ``README.md`` file is created in ``.pytest_cache`` to make it clear why the directory exists. + + pytest 3.6.4 (2018-07-28) ========================= diff --git a/changelog/2220.bugfix.rst b/changelog/2220.bugfix.rst deleted file mode 100644 index e15101131..000000000 --- a/changelog/2220.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix a bug where fixtures overriden by direct parameters (for example parametrization) were being instantiated even if they were not being used by a test. diff --git a/changelog/2283.feature b/changelog/2283.feature deleted file mode 100644 index 9a8f2c4c9..000000000 --- a/changelog/2283.feature +++ /dev/null @@ -1 +0,0 @@ -New ``package`` fixture scope: fixtures are finalized when the last test of a *package* finishes. This feature is considered **experimental**, so use it sparingly. diff --git a/changelog/2639.removal.rst b/changelog/2639.removal.rst deleted file mode 100644 index 3ae6aa4db..000000000 --- a/changelog/2639.removal.rst +++ /dev/null @@ -1,4 +0,0 @@ -``pytest_namespace`` has been deprecated. - -See the documentation for ``pytest_namespace`` hook for suggestions on how to deal -with this in plugins which use this functionality. diff --git a/changelog/3295.doc.rst b/changelog/3295.doc.rst deleted file mode 100644 index c4e351efb..000000000 --- a/changelog/3295.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Correct the usage documentation of ``--last-failed-no-failures`` by adding the missing ``--last-failed`` argument in the presented examples, for they are missleading and lead to think that the missing argument is not needed. diff --git a/changelog/3519.trivial.rst b/changelog/3519.trivial.rst deleted file mode 100644 index a36c4b492..000000000 --- a/changelog/3519.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -Now a ``README.md`` file is created in ``.pytest_cache`` to make it clear why the directory exists. diff --git a/changelog/3576.feature.rst b/changelog/3576.feature.rst deleted file mode 100644 index 6763a00e6..000000000 --- a/changelog/3576.feature.rst +++ /dev/null @@ -1 +0,0 @@ -``Node.add_marker`` now supports an ``append=True/False`` parameter to determine whether the mark comes last (default) or first. diff --git a/changelog/3579.feature.rst b/changelog/3579.feature.rst deleted file mode 100644 index 575af006f..000000000 --- a/changelog/3579.feature.rst +++ /dev/null @@ -1 +0,0 @@ -Fixture ``caplog`` now has a ``messages`` property, providing convenient access to the format-interpolated log messages without the extra data provided by the formatter/handler. diff --git a/changelog/3610.feature.rst b/changelog/3610.feature.rst deleted file mode 100644 index a98295ce8..000000000 --- a/changelog/3610.feature.rst +++ /dev/null @@ -1 +0,0 @@ -New ``--trace`` option to enter the debugger at the start of a test. diff --git a/changelog/3623.feature.rst b/changelog/3623.feature.rst deleted file mode 100644 index 589d858b9..000000000 --- a/changelog/3623.feature.rst +++ /dev/null @@ -1 +0,0 @@ -Introduce ``pytester.copy_example`` as helper to do acceptance tests against examples from the project. diff --git a/changelog/3661.removal.rst b/changelog/3661.removal.rst deleted file mode 100644 index baa30fccf..000000000 --- a/changelog/3661.removal.rst +++ /dev/null @@ -1,3 +0,0 @@ -Calling a fixture function directly, as opposed to request them in a test function, now issues a ``RemovedInPytest4Warning``. It will be changed into an error in pytest ``4.0``. - -This is a great source of confusion to new users, which will often call the fixture functions and request them from test functions interchangeably, which breaks the fixture resolution model. diff --git a/changelog/3695.bugfix.rst b/changelog/3695.bugfix.rst deleted file mode 100644 index 42d07336b..000000000 --- a/changelog/3695.bugfix.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix ``ApproxNumpy`` initialisation argument mixup, ``abs`` and ``rel`` tolerances were flipped causing strange comparsion results. -Add tests to check ``abs`` and ``rel`` tolerances for ``np.array`` and test for expecting ``nan`` with ``np.array()`` diff --git a/changelog/980.bugfix.rst b/changelog/980.bugfix.rst deleted file mode 100644 index e30c38f20..000000000 --- a/changelog/980.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix truncated locals output in verbose mode. diff --git a/doc/en/announce/index.rst b/doc/en/announce/index.rst index 42c3e4d61..a9e40571d 100644 --- a/doc/en/announce/index.rst +++ b/doc/en/announce/index.rst @@ -6,6 +6,7 @@ Release announcements :maxdepth: 2 + release-3.7.0 release-3.6.4 release-3.6.3 release-3.6.2 diff --git a/doc/en/announce/release-3.7.0.rst b/doc/en/announce/release-3.7.0.rst new file mode 100644 index 000000000..922b22517 --- /dev/null +++ b/doc/en/announce/release-3.7.0.rst @@ -0,0 +1,41 @@ +pytest-3.7.0 +======================================= + +The pytest team is proud to announce the 3.7.0 release! + +pytest is a mature Python testing tool with more than a 2000 tests +against itself, passing on many different interpreters and platforms. + +This release contains a number of bugs fixes and improvements, so users are encouraged +to take a look at the CHANGELOG: + + http://doc.pytest.org/en/latest/changelog.html + +For complete documentation, please visit: + + http://docs.pytest.org + +As usual, you can upgrade from pypi via: + + pip install -U pytest + +Thanks to all who contributed to this release, among them: + +* Alan +* Alan Brammer +* Ammar Najjar +* Anthony Sottile +* Bruno Oliveira +* Jeffrey Rackauckas +* Kale Kundert +* Ronny Pfannschmidt +* Serhii Mozghovyi +* Tadek Teleżyński +* Wil Cooley +* abrammer +* avirlrma +* turturica + + +Happy testing, +The Pytest Development Team diff --git a/doc/en/example/markers.rst b/doc/en/example/markers.rst index 1b4aa9279..93dc37197 100644 --- a/doc/en/example/markers.rst +++ b/doc/en/example/markers.rst @@ -31,7 +31,7 @@ You can then restrict a test run to only run tests marked with ``webtest``:: $ pytest -v -m webtest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 + platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.6 cachedir: .pytest_cache rootdir: $REGENDOC_TMPDIR, inifile: collecting ... collected 4 items / 3 deselected @@ -44,7 +44,7 @@ Or the inverse, running all tests except the webtest ones:: $ pytest -v -m "not webtest" =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 + platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.6 cachedir: .pytest_cache rootdir: $REGENDOC_TMPDIR, inifile: collecting ... collected 4 items / 1 deselected @@ -64,7 +64,7 @@ tests based on their module, class, method, or function name:: $ pytest -v test_server.py::TestClass::test_method =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 + platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.6 cachedir: .pytest_cache rootdir: $REGENDOC_TMPDIR, inifile: collecting ... collected 1 item @@ -77,7 +77,7 @@ You can also select on the class:: $ pytest -v test_server.py::TestClass =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 + platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.6 cachedir: .pytest_cache rootdir: $REGENDOC_TMPDIR, inifile: collecting ... collected 1 item @@ -90,7 +90,7 @@ Or select multiple nodes:: $ pytest -v test_server.py::TestClass test_server.py::test_send_http =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 + platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.6 cachedir: .pytest_cache rootdir: $REGENDOC_TMPDIR, inifile: collecting ... collected 2 items @@ -128,7 +128,7 @@ select tests based on their names:: $ pytest -v -k http # running with the above defined example module =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 + platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.6 cachedir: .pytest_cache rootdir: $REGENDOC_TMPDIR, inifile: collecting ... collected 4 items / 3 deselected @@ -141,7 +141,7 @@ And you can also run all tests except the ones that match the keyword:: $ pytest -k "not send_http" -v =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 + platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.6 cachedir: .pytest_cache rootdir: $REGENDOC_TMPDIR, inifile: collecting ... collected 4 items / 1 deselected @@ -156,7 +156,7 @@ Or to select "http" and "quick" tests:: $ pytest -k "http or quick" -v =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 + platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.6 cachedir: .pytest_cache rootdir: $REGENDOC_TMPDIR, inifile: collecting ... collected 4 items / 2 deselected diff --git a/doc/en/example/nonpython.rst b/doc/en/example/nonpython.rst index 4f5adf63f..bda15065a 100644 --- a/doc/en/example/nonpython.rst +++ b/doc/en/example/nonpython.rst @@ -59,7 +59,7 @@ consulted when reporting in ``verbose`` mode:: nonpython $ pytest -v =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 + platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.6 cachedir: .pytest_cache rootdir: $REGENDOC_TMPDIR/nonpython, inifile: collecting ... collected 2 items @@ -84,8 +84,9 @@ interesting to just look at the collection tree:: platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y rootdir: $REGENDOC_TMPDIR/nonpython, inifile: collected 2 items - - - + + + + ======================= no tests ran in 0.12 seconds ======================= diff --git a/doc/en/example/reportingdemo.rst b/doc/en/example/reportingdemo.rst index a7cc81694..c54b9d040 100644 --- a/doc/en/example/reportingdemo.rst +++ b/doc/en/example/reportingdemo.rst @@ -363,7 +363,7 @@ get on the terminal - we are working on that):: > int(s) E ValueError: invalid literal for int() with base 10: 'qwe' - <0-codegen $PYTHON_PREFIX/lib/python3.5/site-packages/_pytest/python_api.py:635>:1: ValueError + <0-codegen $PYTHON_PREFIX/lib/python3.6/site-packages/_pytest/python_api.py:635>:1: ValueError ______________________ TestRaises.test_raises_doesnt _______________________ self = diff --git a/doc/en/example/simple.rst b/doc/en/example/simple.rst index 180637ae9..c6e6c428e 100644 --- a/doc/en/example/simple.rst +++ b/doc/en/example/simple.rst @@ -357,7 +357,7 @@ which will add info only when run with "--v":: $ pytest -v =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 + platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.6 cachedir: .pytest_cache info1: did you know that ... did you? diff --git a/doc/en/fixture.rst b/doc/en/fixture.rst index d7a343f61..8ea13c7f4 100644 --- a/doc/en/fixture.rst +++ b/doc/en/fixture.rst @@ -726,7 +726,7 @@ Running this test will *skip* the invocation of ``data_set`` with value ``2``:: $ pytest test_fixture_marks.py -v =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 + platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.6 cachedir: .pytest_cache rootdir: $REGENDOC_TMPDIR, inifile: collecting ... collected 3 items @@ -769,7 +769,7 @@ Here we declare an ``app`` fixture which receives the previously defined $ pytest -v test_appsetup.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 + platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.6 cachedir: .pytest_cache rootdir: $REGENDOC_TMPDIR, inifile: collecting ... collected 2 items @@ -838,7 +838,7 @@ Let's run the tests in verbose mode and with looking at the print-output:: $ pytest -v -s test_module.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.5 + platform linux -- Python 3.x.y, pytest-3.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python3.6 cachedir: .pytest_cache rootdir: $REGENDOC_TMPDIR, inifile: collecting ... collected 8 items diff --git a/doc/en/getting-started.rst b/doc/en/getting-started.rst index f2dbec5e9..5393195d8 100644 --- a/doc/en/getting-started.rst +++ b/doc/en/getting-started.rst @@ -27,7 +27,7 @@ Install ``pytest`` 2. Check that you installed the correct version:: $ pytest --version - This is pytest version 3.x.y, imported from $PYTHON_PREFIX/lib/python3.5/site-packages/pytest.py + This is pytest version 3.x.y, imported from $PYTHON_PREFIX/lib/python3.6/site-packages/pytest.py .. _`simpletest`: From 997ef593068a36c283cbb83d938272b9770caa36 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Mon, 30 Jul 2018 18:31:35 -0300 Subject: [PATCH 17/17] Fix typos in CHANGELOG --- CHANGELOG.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 31d14ebe3..3b3840620 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -48,7 +48,7 @@ Features Bug Fixes --------- -- `#2220 `_: Fix a bug where fixtures overriden by direct parameters (for example parametrization) were being instantiated even if they were not being used by a test. +- `#2220 `_: Fix a bug where fixtures overridden by direct parameters (for example parametrization) were being instantiated even if they were not being used by a test. - `#3695 `_: Fix ``ApproxNumpy`` initialisation argument mixup, ``abs`` and ``rel`` tolerances were flipped causing strange comparsion results. @@ -62,7 +62,7 @@ Bug Fixes Improved Documentation ---------------------- -- `#3295 `_: Correct the usage documentation of ``--last-failed-no-failures`` by adding the missing ``--last-failed`` argument in the presented examples, for they are missleading and lead to think that the missing argument is not needed. +- `#3295 `_: Correct the usage documentation of ``--last-failed-no-failures`` by adding the missing ``--last-failed`` argument in the presented examples, because they are misleading and lead to think that the missing argument is not needed.