From 1e4b8d447cfaaf4ee7c4636d2a03cf484d06f1cd Mon Sep 17 00:00:00 2001 From: pytest bot Date: Tue, 28 Jul 2020 11:44:27 +0000 Subject: [PATCH 1/8] Prepare release version 6.0.0 --- changelog/5584.breaking.rst | 23 --------- changelog/7389.trivial.rst | 1 - changelog/7392.bugfix.rst | 1 - changelog/7422.doc.rst | 1 - changelog/7441.doc.rst | 1 - changelog/7464.feature.rst | 1 - changelog/7467.improvement.rst | 1 - changelog/7472.breaking.rst | 1 - changelog/7489.improvement.rst | 1 - changelog/7491.bugfix.rst | 2 - changelog/7517.bugfix.rst | 1 - changelog/7534.bugfix.rst | 1 - doc/en/announce/index.rst | 1 + doc/en/announce/release-6.0.0.rst | 40 +++++++++++++++ doc/en/builtin.rst | 13 +++-- doc/en/changelog.rst | 85 +++++++++++++++++++++++++++++++ doc/en/example/parametrize.rst | 4 +- doc/en/getting-started.rst | 2 +- doc/en/writing_plugins.rst | 7 +-- 19 files changed, 138 insertions(+), 49 deletions(-) delete mode 100644 changelog/5584.breaking.rst delete mode 100644 changelog/7389.trivial.rst delete mode 100644 changelog/7392.bugfix.rst delete mode 100644 changelog/7422.doc.rst delete mode 100644 changelog/7441.doc.rst delete mode 100644 changelog/7464.feature.rst delete mode 100644 changelog/7467.improvement.rst delete mode 100644 changelog/7472.breaking.rst delete mode 100644 changelog/7489.improvement.rst delete mode 100644 changelog/7491.bugfix.rst delete mode 100644 changelog/7517.bugfix.rst delete mode 100644 changelog/7534.bugfix.rst create mode 100644 doc/en/announce/release-6.0.0.rst diff --git a/changelog/5584.breaking.rst b/changelog/5584.breaking.rst deleted file mode 100644 index 990d04cb1..000000000 --- a/changelog/5584.breaking.rst +++ /dev/null @@ -1,23 +0,0 @@ -**PytestDeprecationWarning are now errors by default.** - -Following our plan to remove deprecated features with as little disruption as -possible, all warnings of type ``PytestDeprecationWarning`` now generate errors -instead of warning messages. - -**The affected features will be effectively removed in pytest 6.1**, so please consult the -`Deprecations and Removals `__ -section in the docs for directions on how to update existing code. - -In the pytest ``6.0.X`` series, it is possible to change the errors back into warnings as a -stopgap measure by adding this to your ``pytest.ini`` file: - -.. code-block:: ini - - [pytest] - filterwarnings = - ignore::pytest.PytestDeprecationWarning - -But this will stop working when pytest ``6.1`` is released. - -**If you have concerns** about the removal of a specific feature, please add a -comment to `#5584 `__. diff --git a/changelog/7389.trivial.rst b/changelog/7389.trivial.rst deleted file mode 100644 index 00cfe92bc..000000000 --- a/changelog/7389.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -Fixture scope ``package`` is no longer considered experimental. diff --git a/changelog/7392.bugfix.rst b/changelog/7392.bugfix.rst deleted file mode 100644 index 48cd949fa..000000000 --- a/changelog/7392.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix the reported location of tests skipped with ``@pytest.mark.skip`` when ``--runxfail`` is used. diff --git a/changelog/7422.doc.rst b/changelog/7422.doc.rst deleted file mode 100644 index 105fb4be6..000000000 --- a/changelog/7422.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Clarified when the ``usefixtures`` mark can apply fixtures to test. diff --git a/changelog/7441.doc.rst b/changelog/7441.doc.rst deleted file mode 100644 index d7c770e99..000000000 --- a/changelog/7441.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Add a note about ``-q`` option used in getting started guide. diff --git a/changelog/7464.feature.rst b/changelog/7464.feature.rst deleted file mode 100644 index 8b27ee964..000000000 --- a/changelog/7464.feature.rst +++ /dev/null @@ -1 +0,0 @@ -Added support for :envvar:`NO_COLOR` and :envvar:`FORCE_COLOR` environment variables to control colored output. diff --git a/changelog/7467.improvement.rst b/changelog/7467.improvement.rst deleted file mode 100644 index b7cf3b4d8..000000000 --- a/changelog/7467.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -``--log-file`` CLI option and ``log_file`` ini marker now create subdirectories if needed. diff --git a/changelog/7472.breaking.rst b/changelog/7472.breaking.rst deleted file mode 100644 index b76874e37..000000000 --- a/changelog/7472.breaking.rst +++ /dev/null @@ -1 +0,0 @@ -The ``exec_()`` and ``is_true()`` methods of ``_pytest._code.Frame`` have been removed. diff --git a/changelog/7489.improvement.rst b/changelog/7489.improvement.rst deleted file mode 100644 index 218342f2d..000000000 --- a/changelog/7489.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -The :func:`pytest.raises` function has a clearer error message when ``match`` equals the obtained string but is not a regex match. In this case it is suggested to escape the regex. diff --git a/changelog/7491.bugfix.rst b/changelog/7491.bugfix.rst deleted file mode 100644 index 5b00a5713..000000000 --- a/changelog/7491.bugfix.rst +++ /dev/null @@ -1,2 +0,0 @@ -:fixture:`tmpdir` and :fixture:`tmp_path` no longer raise an error if the lock to check for -stale temporary directories is not accessible. diff --git a/changelog/7517.bugfix.rst b/changelog/7517.bugfix.rst deleted file mode 100644 index 2d062dc1e..000000000 --- a/changelog/7517.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Preserve line endings when captured via ``capfd``. diff --git a/changelog/7534.bugfix.rst b/changelog/7534.bugfix.rst deleted file mode 100644 index 7c1f31360..000000000 --- a/changelog/7534.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Restored the previous formatting of ``TracebackEntry.__str__`` which was changed by accident. diff --git a/doc/en/announce/index.rst b/doc/en/announce/index.rst index 31deaad71..7d176aa06 100644 --- a/doc/en/announce/index.rst +++ b/doc/en/announce/index.rst @@ -6,6 +6,7 @@ Release announcements :maxdepth: 2 + release-6.0.0 release-6.0.0rc1 release-5.4.3 release-5.4.2 diff --git a/doc/en/announce/release-6.0.0.rst b/doc/en/announce/release-6.0.0.rst new file mode 100644 index 000000000..a4b0571e4 --- /dev/null +++ b/doc/en/announce/release-6.0.0.rst @@ -0,0 +1,40 @@ +pytest-6.0.0 +======================================= + +The pytest team is proud to announce the 6.0.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 bug 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 +* Arvin Firouzi +* Bruno Oliveira +* Debi Mishra +* Garrett Thomas +* Hugo van Kemenade +* Kelton Bassingthwaite +* Kostis Anagnostopoulos +* Lewis Cowles +* Miro HronĨok +* Ran Benita +* Simon K +* Zac Hatfield-Dodds + + +Happy testing, +The pytest Development Team diff --git a/doc/en/builtin.rst b/doc/en/builtin.rst index 7864233fc..b33ee041d 100644 --- a/doc/en/builtin.rst +++ b/doc/en/builtin.rst @@ -69,11 +69,13 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a ... record_property - Add an extra properties the calling test. + Add extra properties to the calling test. + User properties become part of the test report and are available to the configured reporters, like JUnit XML. - The fixture is callable with ``(name, value)``, with value being automatically - xml-encoded. + + The fixture is callable with ``name, value``. The value is automatically + XML-encoded. Example:: @@ -82,8 +84,9 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a record_xml_attribute Add extra xml attributes to the tag for the calling test. - The fixture is callable with ``(name, value)``, with value being - automatically xml-encoded + + The fixture is callable with ``name, value``. The value is + automatically XML-encoded. record_testsuite_property [session scope] Records a new ```` tag as child of the root ````. This is suitable to diff --git a/doc/en/changelog.rst b/doc/en/changelog.rst index 859dfea79..2b515538a 100644 --- a/doc/en/changelog.rst +++ b/doc/en/changelog.rst @@ -28,6 +28,91 @@ with advance notice in the **Deprecations** section of releases. .. towncrier release notes start +pytest 6.0.0 (2020-07-28) +========================= + +Breaking Changes +---------------- + +- `#5584 `_: **PytestDeprecationWarning are now errors by default.** + + Following our plan to remove deprecated features with as little disruption as + possible, all warnings of type ``PytestDeprecationWarning`` now generate errors + instead of warning messages. + + **The affected features will be effectively removed in pytest 6.1**, so please consult the + `Deprecations and Removals `__ + section in the docs for directions on how to update existing code. + + In the pytest ``6.0.X`` series, it is possible to change the errors back into warnings as a + stopgap measure by adding this to your ``pytest.ini`` file: + + .. code-block:: ini + + [pytest] + filterwarnings = + ignore::pytest.PytestDeprecationWarning + + But this will stop working when pytest ``6.1`` is released. + + **If you have concerns** about the removal of a specific feature, please add a + comment to `#5584 `__. + + +- `#7472 `_: The ``exec_()`` and ``is_true()`` methods of ``_pytest._code.Frame`` have been removed. + + + +Features +-------- + +- `#7464 `_: Added support for :envvar:`NO_COLOR` and :envvar:`FORCE_COLOR` environment variables to control colored output. + + + +Improvements +------------ + +- `#7467 `_: ``--log-file`` CLI option and ``log_file`` ini marker now create subdirectories if needed. + + +- `#7489 `_: The :func:`pytest.raises` function has a clearer error message when ``match`` equals the obtained string but is not a regex match. In this case it is suggested to escape the regex. + + + +Bug Fixes +--------- + +- `#7392 `_: Fix the reported location of tests skipped with ``@pytest.mark.skip`` when ``--runxfail`` is used. + + +- `#7491 `_: :fixture:`tmpdir` and :fixture:`tmp_path` no longer raise an error if the lock to check for + stale temporary directories is not accessible. + + +- `#7517 `_: Preserve line endings when captured via ``capfd``. + + +- `#7534 `_: Restored the previous formatting of ``TracebackEntry.__str__`` which was changed by accident. + + + +Improved Documentation +---------------------- + +- `#7422 `_: Clarified when the ``usefixtures`` mark can apply fixtures to test. + + +- `#7441 `_: Add a note about ``-q`` option used in getting started guide. + + + +Trivial/Internal Changes +------------------------ + +- `#7389 `_: Fixture scope ``package`` is no longer considered experimental. + + pytest 6.0.0rc1 (2020-07-08) ============================ diff --git a/doc/en/example/parametrize.rst b/doc/en/example/parametrize.rst index 8fa48bfe3..f1c98d449 100644 --- a/doc/en/example/parametrize.rst +++ b/doc/en/example/parametrize.rst @@ -508,10 +508,10 @@ Running it results in some skips if we don't have all the python interpreters in .. code-block:: pytest . $ pytest -rs -q multipython.py - ssssssssssssssssssssssss... [100%] + ssssssssssss...ssssssssssss [100%] ========================= short test summary info ========================== SKIPPED [12] multipython.py:29: 'python3.5' not found - SKIPPED [12] multipython.py:29: 'python3.6' not found + SKIPPED [12] multipython.py:29: 'python3.7' not found 3 passed, 24 skipped in 0.12s Indirect parametrization of optional implementations/imports diff --git a/doc/en/getting-started.rst b/doc/en/getting-started.rst index 38adf68e0..a2f6daa39 100644 --- a/doc/en/getting-started.rst +++ b/doc/en/getting-started.rst @@ -28,7 +28,7 @@ Install ``pytest`` .. code-block:: bash $ pytest --version - pytest 6.0.0rc1 + pytest 6.0.0 .. _`simpletest`: diff --git a/doc/en/writing_plugins.rst b/doc/en/writing_plugins.rst index 27ef40e5b..cf4dbf99f 100644 --- a/doc/en/writing_plugins.rst +++ b/doc/en/writing_plugins.rst @@ -442,13 +442,8 @@ additionally it is possible to copy examples for an example folder before runnin $REGENDOC_TMPDIR/test_example.py:4: PytestExperimentalApiWarning: testdir.copy_example is an experimental api that may change over time testdir.copy_example("test_example.py") - test_example.py::test_plugin - $PYTHON_PREFIX/lib/python3.7/site-packages/_pytest/compat.py:340: PytestDeprecationWarning: The TerminalReporter.writer attribute is deprecated, use TerminalReporter._tw instead at your own risk. - See https://docs.pytest.org/en/stable/deprecations.html#terminalreporter-writer for more information. - return getattr(object, name, default) - -- Docs: https://docs.pytest.org/en/stable/warnings.html - ====================== 2 passed, 2 warnings in 0.12s ======================= + ======================= 2 passed, 1 warning in 0.12s ======================= For more information about the result object that ``runpytest()`` returns, and the methods that it provides please check out the :py:class:`RunResult From 45ced1dc056d586fe3714823fa033cab27055c9f Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 28 Jul 2020 10:46:03 -0300 Subject: [PATCH 2/8] Update doc/en/announce/release-6.0.0.rst Co-authored-by: Hugo van Kemenade --- doc/en/announce/release-6.0.0.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/en/announce/release-6.0.0.rst b/doc/en/announce/release-6.0.0.rst index a4b0571e4..9706fe59b 100644 --- a/doc/en/announce/release-6.0.0.rst +++ b/doc/en/announce/release-6.0.0.rst @@ -3,7 +3,7 @@ pytest-6.0.0 The pytest team is proud to announce the 6.0.0 release! -pytest is a mature Python testing tool with more than a 2000 tests +pytest is a mature Python testing tool with more than 2000 tests against itself, passing on many different interpreters and platforms. This release contains a number of bug fixes and improvements, so users are encouraged From 41a453959441d9b03cba3e47730efca27fa2f252 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 28 Jul 2020 14:15:45 -0300 Subject: [PATCH 3/8] Add link to 6.0.0rc1 changelog --- doc/en/changelog.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/en/changelog.rst b/doc/en/changelog.rst index 2b515538a..2ad8de212 100644 --- a/doc/en/changelog.rst +++ b/doc/en/changelog.rst @@ -31,6 +31,8 @@ with advance notice in the **Deprecations** section of releases. pytest 6.0.0 (2020-07-28) ========================= +(**Please see the full set of changes for this release also in the 6.0.0rc1 notes below**) + Breaking Changes ---------------- From edb6211e3692974dc2b0984d71483f3296fcef3f Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Wed, 29 Jul 2020 11:49:41 +0300 Subject: [PATCH 4/8] Merge pull request #7565 from bluetech/pylint-callable-2 mark: fix pylint not-callable error on pytest.mark.parametrize(...), again (cherry picked from commit f9837f953c03268baa4ae8e9803cb3a13ec6860c) --- changelog/7558.bugfix.rst | 2 ++ src/_pytest/mark/structures.py | 14 ++++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) create mode 100644 changelog/7558.bugfix.rst diff --git a/changelog/7558.bugfix.rst b/changelog/7558.bugfix.rst new file mode 100644 index 000000000..6e3ec674c --- /dev/null +++ b/changelog/7558.bugfix.rst @@ -0,0 +1,2 @@ +Fix pylint ``not-callable`` lint on ``pytest.mark.parametrize()`` and the other builtin marks: +``skip``, ``skipif``, ``xfail``, ``usefixtures``, ``filterwarnings``. diff --git a/src/_pytest/mark/structures.py b/src/_pytest/mark/structures.py index 5edeecdd5..9f8ce4ebc 100644 --- a/src/_pytest/mark/structures.py +++ b/src/_pytest/mark/structures.py @@ -4,7 +4,6 @@ import typing import warnings from typing import Any from typing import Callable -from typing import cast from typing import Iterable from typing import List from typing import Mapping @@ -473,14 +472,13 @@ class MarkGenerator: # See TYPE_CHECKING above. if TYPE_CHECKING: - # Using casts instead of type comments intentionally - issue #7473. # TODO(py36): Change to builtin annotation syntax. - skip = cast(_SkipMarkDecorator, None) - skipif = cast(_SkipifMarkDecorator, None) - xfail = cast(_XfailMarkDecorator, None) - parametrize = cast(_ParametrizeMarkDecorator, None) - usefixtures = cast(_UsefixturesMarkDecorator, None) - filterwarnings = cast(_FilterwarningsMarkDecorator, None) + skip = _SkipMarkDecorator(Mark("skip", (), {})) + skipif = _SkipifMarkDecorator(Mark("skipif", (), {})) + xfail = _XfailMarkDecorator(Mark("xfail", (), {})) + parametrize = _ParametrizeMarkDecorator(Mark("parametrize ", (), {})) + usefixtures = _UsefixturesMarkDecorator(Mark("usefixtures ", (), {})) + filterwarnings = _FilterwarningsMarkDecorator(Mark("filterwarnings ", (), {})) def __getattr__(self, name: str) -> MarkDecorator: if name[0] == "_": From bec1bdaa2cf53bc6213a106edec1131287adc22d Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Wed, 29 Jul 2020 11:58:54 +0300 Subject: [PATCH 5/8] mark: fix extraneous spaces in dummy type-checking marks (cherry picked from commit 54e08b72304908b0cddb1ec68c297815cbd7f757) --- src/_pytest/mark/structures.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/_pytest/mark/structures.py b/src/_pytest/mark/structures.py index 9f8ce4ebc..656782299 100644 --- a/src/_pytest/mark/structures.py +++ b/src/_pytest/mark/structures.py @@ -476,9 +476,9 @@ class MarkGenerator: skip = _SkipMarkDecorator(Mark("skip", (), {})) skipif = _SkipifMarkDecorator(Mark("skipif", (), {})) xfail = _XfailMarkDecorator(Mark("xfail", (), {})) - parametrize = _ParametrizeMarkDecorator(Mark("parametrize ", (), {})) - usefixtures = _UsefixturesMarkDecorator(Mark("usefixtures ", (), {})) - filterwarnings = _FilterwarningsMarkDecorator(Mark("filterwarnings ", (), {})) + parametrize = _ParametrizeMarkDecorator(Mark("parametrize", (), {})) + usefixtures = _UsefixturesMarkDecorator(Mark("usefixtures", (), {})) + filterwarnings = _FilterwarningsMarkDecorator(Mark("filterwarnings", (), {})) def __getattr__(self, name: str) -> MarkDecorator: if name[0] == "_": From f9d5f6e60a3e64fbdc5b03ceff3eeb56ddeb9c7d Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 29 Jul 2020 09:37:57 -0300 Subject: [PATCH 6/8] Merge pull request #7571 from bluetech/logging-setlevel-handler-restore logging: fix capture handler level not reset on teardown after caplog.set_level() --- src/_pytest/logging.py | 4 ++++ testing/logging/test_fixture.py | 35 +++++++++++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/_pytest/logging.py b/src/_pytest/logging.py index 11031f2f2..0ee9457ea 100644 --- a/src/_pytest/logging.py +++ b/src/_pytest/logging.py @@ -345,6 +345,7 @@ class LogCaptureFixture: """Creates a new funcarg.""" self._item = item # dict of log name -> log level + self._initial_handler_level = None # type: Optional[int] self._initial_logger_levels = {} # type: Dict[Optional[str], int] def _finalize(self) -> None: @@ -353,6 +354,8 @@ class LogCaptureFixture: This restores the log levels changed by :meth:`set_level`. """ # restore log levels + if self._initial_handler_level is not None: + self.handler.setLevel(self._initial_handler_level) for logger_name, level in self._initial_logger_levels.items(): logger = logging.getLogger(logger_name) logger.setLevel(level) @@ -434,6 +437,7 @@ class LogCaptureFixture: # save the original log-level to restore it during teardown self._initial_logger_levels.setdefault(logger, logger_obj.level) logger_obj.setLevel(level) + self._initial_handler_level = self.handler.level self.handler.setLevel(level) @contextmanager diff --git a/testing/logging/test_fixture.py b/testing/logging/test_fixture.py index da5303302..6e5e9c2b4 100644 --- a/testing/logging/test_fixture.py +++ b/testing/logging/test_fixture.py @@ -2,6 +2,7 @@ import logging import pytest from _pytest.logging import caplog_records_key +from _pytest.pytester import Testdir logger = logging.getLogger(__name__) sublogger = logging.getLogger(__name__ + ".baz") @@ -27,8 +28,11 @@ def test_change_level(caplog): assert "CRITICAL" in caplog.text -def test_change_level_undo(testdir): - """Ensure that 'set_level' is undone after the end of the test""" +def test_change_level_undo(testdir: Testdir) -> None: + """Ensure that 'set_level' is undone after the end of the test. + + Tests the logging output themselves (affacted both by logger and handler levels). + """ testdir.makepyfile( """ import logging @@ -50,6 +54,33 @@ def test_change_level_undo(testdir): result.stdout.no_fnmatch_line("*log from test2*") +def test_change_level_undos_handler_level(testdir: Testdir) -> None: + """Ensure that 'set_level' is undone after the end of the test (handler). + + Issue #7569. Tests the handler level specifically. + """ + testdir.makepyfile( + """ + import logging + + def test1(caplog): + assert caplog.handler.level == 0 + caplog.set_level(41) + assert caplog.handler.level == 41 + + def test2(caplog): + assert caplog.handler.level == 0 + + def test3(caplog): + assert caplog.handler.level == 0 + caplog.set_level(43) + assert caplog.handler.level == 43 + """ + ) + result = testdir.runpytest() + result.assert_outcomes(passed=3) + + def test_with_statement(caplog): with caplog.at_level(logging.INFO): logger.debug("handler DEBUG level") From fe252848c56e081fc7eb1b98cd60e33ee33b7dd7 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 29 Jul 2020 09:47:04 -0300 Subject: [PATCH 7/8] Merge pull request #7561 from nicoddemus/longreprtext-7559 --- changelog/7559.bugfix.rst | 1 + src/_pytest/reports.py | 5 +++-- testing/test_runner.py | 27 +++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 changelog/7559.bugfix.rst diff --git a/changelog/7559.bugfix.rst b/changelog/7559.bugfix.rst new file mode 100644 index 000000000..b3d98826b --- /dev/null +++ b/changelog/7559.bugfix.rst @@ -0,0 +1 @@ +Fix regression in plugins using ``TestReport.longreprtext`` (such as ``pytest-html``) when ``TestReport.longrepr`` is not a string. diff --git a/src/_pytest/reports.py b/src/_pytest/reports.py index 186c53ed3..cbd9ae183 100644 --- a/src/_pytest/reports.py +++ b/src/_pytest/reports.py @@ -82,9 +82,10 @@ class BaseReport: longrepr.toterminal(out) else: try: - out.line(longrepr) + s = str(longrepr) except UnicodeEncodeError: - out.line("") + s = "" + out.line(s) def get_sections(self, prefix: str) -> Iterator[Tuple[str, str]]: for name, content in self.sections: diff --git a/testing/test_runner.py b/testing/test_runner.py index def3f910d..b207ccc92 100644 --- a/testing/test_runner.py +++ b/testing/test_runner.py @@ -951,6 +951,33 @@ class TestReportContents: rep = reports[1] assert rep.longreprtext == "" + def test_longreprtext_skip(self, testdir) -> None: + """TestReport.longreprtext can handle non-str ``longrepr`` attributes (#7559)""" + reports = testdir.runitem( + """ + import pytest + def test_func(): + pytest.skip() + """ + ) + _, call_rep, _ = reports + assert isinstance(call_rep.longrepr, tuple) + assert "Skipped" in call_rep.longreprtext + + def test_longreprtext_collect_skip(self, testdir) -> None: + """CollectReport.longreprtext can handle non-str ``longrepr`` attributes (#7559)""" + testdir.makepyfile( + """ + import pytest + pytest.skip(allow_module_level=True) + """ + ) + rec = testdir.inline_run() + calls = rec.getcalls("pytest_collectreport") + _, call = calls + assert isinstance(call.report.longrepr, tuple) + assert "Skipped" in call.report.longreprtext + def test_longreprtext_failure(self, testdir) -> None: reports = testdir.runitem( """ From 22acbaf3934979cc916a932263a7dd41810a1b1c Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 29 Jul 2020 11:29:24 -0300 Subject: [PATCH 8/8] Minor changes to the release process As discussed in https://github.com/pytest-dev/pytest/pull/7556 --- RELEASING.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/RELEASING.rst b/RELEASING.rst index f5e2528e3..5893987e3 100644 --- a/RELEASING.rst +++ b/RELEASING.rst @@ -69,9 +69,9 @@ Both automatic and manual processes described above follow the same steps from t git fetch --all --prune git checkout origin/master -b cherry-pick-release - git cherry-pick --no-commit -m1 origin/MAJOR.MINOR.x - git checkout origin/master -- changelog - git commit # no arguments + git cherry-pick -x -m1 origin/MAJOR.MINOR.x + +#. Open a PR for ``cherry-pick-release`` and merge it once CI passes. No need to wait for approvals if there were no conflicts on the previous step. #. Send an email announcement with the contents from::