From 63fe547d9f97a78c63a91e139d3a17c15afe7e84 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Sat, 11 May 2019 16:35:32 +0000 Subject: [PATCH] Preparing release version 4.5.0 --- CHANGELOG.rst | 133 ++++++++++++++++++++++++++++++ changelog/4826.feature.rst | 2 - changelog/4907.feature.rst | 1 - changelog/4935.doc.rst | 1 - changelog/4942.trivial.rst | 1 - changelog/5013.feature.rst | 1 - changelog/5013.trivial.rst | 1 - changelog/5023.feature.rst | 5 -- changelog/5026.feature.rst | 1 - changelog/5034.feature.rst | 1 - changelog/5035.feature.rst | 1 - changelog/5059.feature.rst | 1 - changelog/5059.trivial.rst | 1 - changelog/5068.feature.rst | 1 - changelog/5069.trivial.rst | 1 - changelog/5082.trivial.rst | 1 - changelog/5108.feature.rst | 1 - changelog/5113.bugfix.rst | 1 - changelog/5144.bugfix.rst | 1 - changelog/5172.feature.rst | 2 - changelog/5177.feature.rst | 14 ---- changelog/5202.feature.rst | 5 -- changelog/5202.trivial.rst | 4 - changelog/5214.feature.rst | 10 --- changelog/5220.feature.rst | 1 - changelog/5235.bugfix.rst | 1 - changelog/5239.trivial.rst | 3 - doc/en/announce/index.rst | 1 + doc/en/announce/release-4.5.0.rst | 35 ++++++++ doc/en/builtin.rst | 14 ++++ doc/en/example/simple.rst | 2 +- 31 files changed, 184 insertions(+), 64 deletions(-) delete mode 100644 changelog/4826.feature.rst delete mode 100644 changelog/4907.feature.rst delete mode 100644 changelog/4935.doc.rst delete mode 100644 changelog/4942.trivial.rst delete mode 100644 changelog/5013.feature.rst delete mode 100644 changelog/5013.trivial.rst delete mode 100644 changelog/5023.feature.rst delete mode 100644 changelog/5026.feature.rst delete mode 100644 changelog/5034.feature.rst delete mode 100644 changelog/5035.feature.rst delete mode 100644 changelog/5059.feature.rst delete mode 100644 changelog/5059.trivial.rst delete mode 100644 changelog/5068.feature.rst delete mode 100644 changelog/5069.trivial.rst delete mode 100644 changelog/5082.trivial.rst delete mode 100644 changelog/5108.feature.rst delete mode 100644 changelog/5113.bugfix.rst delete mode 100644 changelog/5144.bugfix.rst delete mode 100644 changelog/5172.feature.rst delete mode 100644 changelog/5177.feature.rst delete mode 100644 changelog/5202.feature.rst delete mode 100644 changelog/5202.trivial.rst delete mode 100644 changelog/5214.feature.rst delete mode 100644 changelog/5220.feature.rst delete mode 100644 changelog/5235.bugfix.rst delete mode 100644 changelog/5239.trivial.rst create mode 100644 doc/en/announce/release-4.5.0.rst diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e035a1a4d..013e891d8 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -18,6 +18,139 @@ with advance notice in the **Deprecations** section of releases. .. towncrier release notes start +pytest 4.5.0 (2019-05-11) +========================= + +Features +-------- + +- `#4826 `_: A warning is now emitted when unknown marks are used as a decorator. + This is often due to a typo, which can lead to silently broken tests. + + +- `#4907 `_: Show XFail reason as part of JUnitXML message field. + + +- `#5013 `_: Messages from crash reports are displayed within test summaries now, truncated to the terminal width. + + +- `#5023 `_: New flag ``--strict-markers`` that triggers an error when unknown markers (e.g. those not registered using the `markers option`_ in the configuration file) are used in the test suite. + + The existing ``--strict`` option has the same behavior currently, but can be augmented in the future for additional checks. + + .. _`markers option`: https://docs.pytest.org/en/latest/reference.html#confval-markers + + +- `#5026 `_: Assertion failure messages for sequences and dicts contain the number of different items now. + + +- `#5034 `_: Improve reporting with ``--lf`` and ``--ff`` (run-last-failure). + + +- `#5035 `_: The ``--cache-show`` option/action accepts an optional glob to show only matching cache entries. + + +- `#5059 `_: Standard input (stdin) can be given to pytester's ``Testdir.run()`` and ``Testdir.popen()``. + + +- `#5068 `_: The ``-r`` option learnt about ``A`` to display all reports (including passed ones) in the short test summary. + + +- `#5108 `_: The short test summary is displayed after passes with output (``-rP``). + + +- `#5172 `_: The ``--last-failed`` (``--lf``) option got smarter and will now skip entire files if all tests + of that test file have passed in previous runs, greatly speeding up collection. + + +- `#5177 `_: Introduce new specific warning ``PytestWarning`` subclasses to make it easier to filter warnings based on the class, rather than on the message. The new subclasses are: + + + * ``PytestAssertRewriteWarning`` + + * ``PytestCacheWarning`` + + * ``PytestCollectionWarning`` + + * ``PytestConfigWarning`` + + * ``PytestUnhandledCoroutineWarning`` + + * ``PytestUnknownMarkWarning`` + + +- `#5202 `_: New ``record_testsuite_property`` session-scoped fixture allows users to log ```` tags at the ``testsuite`` + level with the ``junitxml`` plugin. + + The generated XML is compatible with the latest xunit standard, contrary to + the properties recorded by ``record_property`` and ``record_xml_attribute``. + + +- `#5214 `_: The default logging format has been changed to improve readability. Here is an + example of a previous logging message:: + + test_log_cli_enabled_disabled.py 3 CRITICAL critical message logged by test + + This has now become:: + + CRITICAL root:test_log_cli_enabled_disabled.py:3 critical message logged by test + + The formatting can be changed through the `log_format `__ configuration option. + + +- `#5220 `_: ``--fixtures`` now also shows fixture scope for scopes other than ``"function"``. + + + +Bug Fixes +--------- + +- `#5113 `_: Deselected items from plugins using ``pytest_collect_modifyitems`` as a hookwrapper are correctly reported now. + + +- `#5144 `_: With usage errors ``exitstatus`` is set to ``EXIT_USAGEERROR`` in the ``pytest_sessionfinish`` hook now as expected. + + +- `#5235 `_: ``outcome.exit`` is not used with ``EOF`` in the pdb wrapper anymore, but only with ``quit``. + + + +Improved Documentation +---------------------- + +- `#4935 `_: Expand docs on registering marks and the effect of ``--strict``. + + + +Trivial/Internal Changes +------------------------ + +- `#4942 `_: ``logging.raiseExceptions`` is not set to ``False`` anymore. + + +- `#5013 `_: pytest now depends on `wcwidth `__ to properly track unicode character sizes for more precise terminal output. + + +- `#5059 `_: pytester's ``Testdir.popen()`` uses ``stdout`` and ``stderr`` via keyword arguments with defaults now (``subprocess.PIPE``). + + +- `#5069 `_: The code for the short test summary in the terminal was moved to the terminal plugin. + + +- `#5082 `_: Improved validation of kwargs for various methods in the pytester plugin. + + +- `#5202 `_: ``record_property`` now emits a ``PytestWarning`` when used with ``junit_family=xunit2``: the fixture generates + ``property`` tags as children of ``testcase``, which is not permitted according to the most + `recent schema `__. + + +- `#5239 `_: 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``. + + pytest 4.4.2 (2019-05-08) ========================= diff --git a/changelog/4826.feature.rst b/changelog/4826.feature.rst deleted file mode 100644 index 2afcba1ad..000000000 --- a/changelog/4826.feature.rst +++ /dev/null @@ -1,2 +0,0 @@ -A warning is now emitted when unknown marks are used as a decorator. -This is often due to a typo, which can lead to silently broken tests. diff --git a/changelog/4907.feature.rst b/changelog/4907.feature.rst deleted file mode 100644 index 48bece401..000000000 --- a/changelog/4907.feature.rst +++ /dev/null @@ -1 +0,0 @@ -Show XFail reason as part of JUnitXML message field. diff --git a/changelog/4935.doc.rst b/changelog/4935.doc.rst deleted file mode 100644 index ac948b568..000000000 --- a/changelog/4935.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Expand docs on registering marks and the effect of ``--strict``. diff --git a/changelog/4942.trivial.rst b/changelog/4942.trivial.rst deleted file mode 100644 index 87dba6b8c..000000000 --- a/changelog/4942.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -``logging.raiseExceptions`` is not set to ``False`` anymore. diff --git a/changelog/5013.feature.rst b/changelog/5013.feature.rst deleted file mode 100644 index 08f82efeb..000000000 --- a/changelog/5013.feature.rst +++ /dev/null @@ -1 +0,0 @@ -Messages from crash reports are displayed within test summaries now, truncated to the terminal width. diff --git a/changelog/5013.trivial.rst b/changelog/5013.trivial.rst deleted file mode 100644 index fff4eaf3f..000000000 --- a/changelog/5013.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -pytest now depends on `wcwidth `__ to properly track unicode character sizes for more precise terminal output. diff --git a/changelog/5023.feature.rst b/changelog/5023.feature.rst deleted file mode 100644 index 348e2f1c3..000000000 --- a/changelog/5023.feature.rst +++ /dev/null @@ -1,5 +0,0 @@ -New flag ``--strict-markers`` that triggers an error when unknown markers (e.g. those not registered using the `markers option`_ in the configuration file) are used in the test suite. - -The existing ``--strict`` option has the same behavior currently, but can be augmented in the future for additional checks. - -.. _`markers option`: https://docs.pytest.org/en/latest/reference.html#confval-markers diff --git a/changelog/5026.feature.rst b/changelog/5026.feature.rst deleted file mode 100644 index aa0f3cbb3..000000000 --- a/changelog/5026.feature.rst +++ /dev/null @@ -1 +0,0 @@ -Assertion failure messages for sequences and dicts contain the number of different items now. diff --git a/changelog/5034.feature.rst b/changelog/5034.feature.rst deleted file mode 100644 index 6ae2def3f..000000000 --- a/changelog/5034.feature.rst +++ /dev/null @@ -1 +0,0 @@ -Improve reporting with ``--lf`` and ``--ff`` (run-last-failure). diff --git a/changelog/5035.feature.rst b/changelog/5035.feature.rst deleted file mode 100644 index 36211f9f4..000000000 --- a/changelog/5035.feature.rst +++ /dev/null @@ -1 +0,0 @@ -The ``--cache-show`` option/action accepts an optional glob to show only matching cache entries. diff --git a/changelog/5059.feature.rst b/changelog/5059.feature.rst deleted file mode 100644 index 4d5d14061..000000000 --- a/changelog/5059.feature.rst +++ /dev/null @@ -1 +0,0 @@ -Standard input (stdin) can be given to pytester's ``Testdir.run()`` and ``Testdir.popen()``. diff --git a/changelog/5059.trivial.rst b/changelog/5059.trivial.rst deleted file mode 100644 index bd8035669..000000000 --- a/changelog/5059.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -pytester's ``Testdir.popen()`` uses ``stdout`` and ``stderr`` via keyword arguments with defaults now (``subprocess.PIPE``). diff --git a/changelog/5068.feature.rst b/changelog/5068.feature.rst deleted file mode 100644 index bceebffc1..000000000 --- a/changelog/5068.feature.rst +++ /dev/null @@ -1 +0,0 @@ -The ``-r`` option learnt about ``A`` to display all reports (including passed ones) in the short test summary. diff --git a/changelog/5069.trivial.rst b/changelog/5069.trivial.rst deleted file mode 100644 index dd6abd8b8..000000000 --- a/changelog/5069.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -The code for the short test summary in the terminal was moved to the terminal plugin. diff --git a/changelog/5082.trivial.rst b/changelog/5082.trivial.rst deleted file mode 100644 index edd23a28f..000000000 --- a/changelog/5082.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -Improved validation of kwargs for various methods in the pytester plugin. diff --git a/changelog/5108.feature.rst b/changelog/5108.feature.rst deleted file mode 100644 index 3b66ce5bf..000000000 --- a/changelog/5108.feature.rst +++ /dev/null @@ -1 +0,0 @@ -The short test summary is displayed after passes with output (``-rP``). diff --git a/changelog/5113.bugfix.rst b/changelog/5113.bugfix.rst deleted file mode 100644 index 713b48967..000000000 --- a/changelog/5113.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Deselected items from plugins using ``pytest_collect_modifyitems`` as a hookwrapper are correctly reported now. diff --git a/changelog/5144.bugfix.rst b/changelog/5144.bugfix.rst deleted file mode 100644 index c8c270288..000000000 --- a/changelog/5144.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -With usage errors ``exitstatus`` is set to ``EXIT_USAGEERROR`` in the ``pytest_sessionfinish`` hook now as expected. diff --git a/changelog/5172.feature.rst b/changelog/5172.feature.rst deleted file mode 100644 index 85b55f922..000000000 --- a/changelog/5172.feature.rst +++ /dev/null @@ -1,2 +0,0 @@ -The ``--last-failed`` (``--lf``) option got smarter and will now skip entire files if all tests -of that test file have passed in previous runs, greatly speeding up collection. diff --git a/changelog/5177.feature.rst b/changelog/5177.feature.rst deleted file mode 100644 index a5b4ab111..000000000 --- a/changelog/5177.feature.rst +++ /dev/null @@ -1,14 +0,0 @@ -Introduce new specific warning ``PytestWarning`` subclasses to make it easier to filter warnings based on the class, rather than on the message. The new subclasses are: - - -* ``PytestAssertRewriteWarning`` - -* ``PytestCacheWarning`` - -* ``PytestCollectionWarning`` - -* ``PytestConfigWarning`` - -* ``PytestUnhandledCoroutineWarning`` - -* ``PytestUnknownMarkWarning`` diff --git a/changelog/5202.feature.rst b/changelog/5202.feature.rst deleted file mode 100644 index 82b718d9c..000000000 --- a/changelog/5202.feature.rst +++ /dev/null @@ -1,5 +0,0 @@ -New ``record_testsuite_property`` session-scoped fixture allows users to log ```` tags at the ``testsuite`` -level with the ``junitxml`` plugin. - -The generated XML is compatible with the latest xunit standard, contrary to -the properties recorded by ``record_property`` and ``record_xml_attribute``. diff --git a/changelog/5202.trivial.rst b/changelog/5202.trivial.rst deleted file mode 100644 index 2eaaf0ca4..000000000 --- a/changelog/5202.trivial.rst +++ /dev/null @@ -1,4 +0,0 @@ -``record_property`` now emits a ``PytestWarning`` when used with ``junit_family=xunit2``: the fixture generates -``property`` tags as children of ``testcase``, which is not permitted according to the most -`recent schema `__. diff --git a/changelog/5214.feature.rst b/changelog/5214.feature.rst deleted file mode 100644 index 422a4dd85..000000000 --- a/changelog/5214.feature.rst +++ /dev/null @@ -1,10 +0,0 @@ -The default logging format has been changed to improve readability. Here is an -example of a previous logging message:: - - test_log_cli_enabled_disabled.py 3 CRITICAL critical message logged by test - -This has now become:: - - CRITICAL root:test_log_cli_enabled_disabled.py:3 critical message logged by test - -The formatting can be changed through the `log_format `__ configuration option. diff --git a/changelog/5220.feature.rst b/changelog/5220.feature.rst deleted file mode 100644 index cf535afa0..000000000 --- a/changelog/5220.feature.rst +++ /dev/null @@ -1 +0,0 @@ -``--fixtures`` now also shows fixture scope for scopes other than ``"function"``. diff --git a/changelog/5235.bugfix.rst b/changelog/5235.bugfix.rst deleted file mode 100644 index 87597a589..000000000 --- a/changelog/5235.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -``outcome.exit`` is not used with ``EOF`` in the pdb wrapper anymore, but only with ``quit``. diff --git a/changelog/5239.trivial.rst b/changelog/5239.trivial.rst deleted file mode 100644 index 5bd7389f3..000000000 --- a/changelog/5239.trivial.rst +++ /dev/null @@ -1,3 +0,0 @@ -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``. diff --git a/doc/en/announce/index.rst b/doc/en/announce/index.rst index 179e40abe..8b5ca7b0a 100644 --- a/doc/en/announce/index.rst +++ b/doc/en/announce/index.rst @@ -6,6 +6,7 @@ Release announcements :maxdepth: 2 + release-4.5.0 release-4.4.2 release-4.4.1 release-4.4.0 diff --git a/doc/en/announce/release-4.5.0.rst b/doc/en/announce/release-4.5.0.rst new file mode 100644 index 000000000..084579ac4 --- /dev/null +++ b/doc/en/announce/release-4.5.0.rst @@ -0,0 +1,35 @@ +pytest-4.5.0 +======================================= + +The pytest team is proud to announce the 4.5.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: + + https://docs.pytest.org/en/latest/changelog.html + +For complete documentation, please visit: + + https://docs.pytest.org/en/latest/ + +As usual, you can upgrade from pypi via: + + pip install -U pytest + +Thanks to all who contributed to this release, among them: + +* Anthony Sottile +* Bruno Oliveira +* Daniel Hahler +* Floris Bruynooghe +* Pulkit Goyal +* Samuel Searles-Bryant +* Zac Hatfield-Dodds +* Zac-HD + + +Happy testing, +The Pytest Development Team diff --git a/doc/en/builtin.rst b/doc/en/builtin.rst index c7d6b271f..a4c20695c 100644 --- a/doc/en/builtin.rst +++ b/doc/en/builtin.rst @@ -85,6 +85,20 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a The fixture is callable with ``(name, value)``, with value being automatically xml-encoded + record_testsuite_property [session scope] + Records a new ```` tag as child of the root ````. This is suitable to + writing global information regarding the entire test suite, and is compatible with ``xunit2`` JUnit family. + + This is a ``session``-scoped fixture which is called with ``(name, value)``. Example: + + .. code-block:: python + + def test_foo(record_testsuite_property): + record_testsuite_property("ARCH", "PPC") + record_testsuite_property("STORAGE_TYPE", "CEPH") + + ``name`` must be a string, ``value`` will be converted to a string and properly xml-escaped. + caplog Access and control log capturing. diff --git a/doc/en/example/simple.rst b/doc/en/example/simple.rst index 1c7c10570..140f4b840 100644 --- a/doc/en/example/simple.rst +++ b/doc/en/example/simple.rst @@ -606,7 +606,7 @@ We can run this: file $REGENDOC_TMPDIR/b/test_error.py, line 1 def test_root(db): # no db here, will error out E fixture 'db' not found - > available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory + > available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory > use 'pytest --fixtures [testpath]' for help on them. $REGENDOC_TMPDIR/b/test_error.py:1