From 7d033a89505484d03b1fc4a885ecea1777ca7457 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 8 Jul 2020 17:51:01 -0400 Subject: [PATCH] Prepare release version 6.0.0rc1 --- changelog/1120.bugfix.rst | 1 - changelog/1316.breaking.rst | 1 - changelog/1556.feature.rst | 17 -- changelog/3342.feature.rst | 10 - changelog/4049.feature.rst | 3 - changelog/4375.improvement.rst | 3 - changelog/4391.improvement.rst | 1 - changelog/4583.bugfix.rst | 1 - changelog/4675.improvement.rst | 1 - changelog/4677.bugfix.rst | 1 - changelog/5456.bugfix.rst | 2 - changelog/5965.breaking.rst | 9 - changelog/6240.bugfix.rst | 2 - changelog/6285.feature.rst | 2 - changelog/6428.bugfix.rst | 2 - changelog/6433.feature.rst | 10 - changelog/6471.feature.rst | 4 - changelog/6505.breaking.rst | 20 -- changelog/6755.bugfix.rst | 1 - changelog/6817.improvement.rst | 2 - changelog/6856.feature.rst | 3 - changelog/6871.bugfix.rst | 1 - changelog/6903.breaking.rst | 2 - changelog/6906.feature.rst | 1 - changelog/6909.bugfix.rst | 3 - changelog/6910.bugfix.rst | 1 - changelog/6924.bugfix.rst | 1 - changelog/6925.bugfix.rst | 1 - changelog/6940.improvement.rst | 1 - changelog/6947.bugfix.rst | 1 - changelog/6951.bugfix.rst | 1 - changelog/6956.bugfix.rst | 1 - changelog/6981.deprecation.rst | 1 - changelog/6991.bugfix.rst | 1 - changelog/6991.improvement.rst | 1 - changelog/6992.bugfix.rst | 1 - changelog/7035.trivial.rst | 2 - changelog/7040.breaking.rst | 6 - changelog/7061.bugfix.rst | 1 - changelog/7076.bugfix.rst | 1 - changelog/7091.improvement.rst | 4 - changelog/7097.deprecation.rst | 6 - changelog/7110.bugfix.rst | 1 - changelog/7119.improvement.rst | 2 - changelog/7122.breaking.rst | 3 - changelog/7126.bugfix.rst | 2 - changelog/7128.improvement.rst | 1 - changelog/7133.improvement.rst | 1 - changelog/7135.breaking.rst | 15 - changelog/7143.bugfix.rst | 1 - changelog/7145.bugfix.rst | 1 - changelog/7150.bugfix.rst | 1 - changelog/7159.improvement.rst | 3 - changelog/7180.bugfix.rst | 1 - changelog/7202.doc.rst | 1 - changelog/7210.deprecation.rst | 5 - changelog/7215.bugfix.rst | 2 - changelog/7224.breaking.rst | 4 - changelog/7226.breaking.rst | 1 - changelog/7233.doc.rst | 1 - changelog/7245.feature.rst | 14 - changelog/7253.bugfix.rst | 3 - changelog/7264.improvement.rst | 1 - changelog/7291.trivial.rst | 1 - changelog/7295.trivial.rst | 1 - changelog/7305.feature.rst | 1 - changelog/7345.doc.rst | 1 - changelog/7346.feature.rst | 1 - changelog/7348.improvement.rst | 1 - changelog/7356.trivial.rst | 1 - changelog/7357.trivial.rst | 1 - changelog/7360.bugfix.rst | 2 - changelog/7383.bugfix.rst | 1 - changelog/7385.improvement.rst | 13 - changelog/7418.breaking.rst | 2 - changelog/7438.breaking.rst | 11 - doc/en/announce/index.rst | 1 + doc/en/announce/release-6.0.0rc1.rst | 69 +++++ doc/en/assert.rst | 4 +- doc/en/cache.rst | 36 +-- doc/en/capture.rst | 2 +- doc/en/changelog.rst | 417 +++++++++++++++++++++++++++ doc/en/doctest.rst | 4 +- doc/en/example/markers.rst | 38 +-- doc/en/example/nonpython.rst | 9 +- doc/en/example/parametrize.rst | 33 ++- doc/en/example/pythoncollection.rst | 14 +- doc/en/example/reportingdemo.rst | 123 ++++---- doc/en/example/simple.rst | 24 +- doc/en/fixture.rst | 13 +- doc/en/getting-started.rst | 35 +-- doc/en/index.rst | 2 +- doc/en/parametrize.rst | 4 +- doc/en/skipping.rst | 2 +- doc/en/tmpdir.rst | 4 +- doc/en/unittest.rst | 2 +- doc/en/usage.rst | 10 +- doc/en/warnings.rst | 2 +- doc/en/writing_plugins.rst | 6 +- 99 files changed, 678 insertions(+), 411 deletions(-) delete mode 100644 changelog/1120.bugfix.rst delete mode 100644 changelog/1316.breaking.rst delete mode 100644 changelog/1556.feature.rst delete mode 100644 changelog/3342.feature.rst delete mode 100644 changelog/4049.feature.rst delete mode 100644 changelog/4375.improvement.rst delete mode 100644 changelog/4391.improvement.rst delete mode 100644 changelog/4583.bugfix.rst delete mode 100644 changelog/4675.improvement.rst delete mode 100644 changelog/4677.bugfix.rst delete mode 100644 changelog/5456.bugfix.rst delete mode 100644 changelog/5965.breaking.rst delete mode 100644 changelog/6240.bugfix.rst delete mode 100644 changelog/6285.feature.rst delete mode 100644 changelog/6428.bugfix.rst delete mode 100644 changelog/6433.feature.rst delete mode 100644 changelog/6471.feature.rst delete mode 100644 changelog/6505.breaking.rst delete mode 100644 changelog/6755.bugfix.rst delete mode 100644 changelog/6817.improvement.rst delete mode 100644 changelog/6856.feature.rst delete mode 100644 changelog/6871.bugfix.rst delete mode 100644 changelog/6903.breaking.rst delete mode 100644 changelog/6906.feature.rst delete mode 100644 changelog/6909.bugfix.rst delete mode 100644 changelog/6910.bugfix.rst delete mode 100644 changelog/6924.bugfix.rst delete mode 100644 changelog/6925.bugfix.rst delete mode 100644 changelog/6940.improvement.rst delete mode 100644 changelog/6947.bugfix.rst delete mode 100644 changelog/6951.bugfix.rst delete mode 100644 changelog/6956.bugfix.rst delete mode 100644 changelog/6981.deprecation.rst delete mode 100644 changelog/6991.bugfix.rst delete mode 100644 changelog/6991.improvement.rst delete mode 100644 changelog/6992.bugfix.rst delete mode 100644 changelog/7035.trivial.rst delete mode 100644 changelog/7040.breaking.rst delete mode 100644 changelog/7061.bugfix.rst delete mode 100644 changelog/7076.bugfix.rst delete mode 100644 changelog/7091.improvement.rst delete mode 100644 changelog/7097.deprecation.rst delete mode 100644 changelog/7110.bugfix.rst delete mode 100644 changelog/7119.improvement.rst delete mode 100644 changelog/7122.breaking.rst delete mode 100644 changelog/7126.bugfix.rst delete mode 100644 changelog/7128.improvement.rst delete mode 100644 changelog/7133.improvement.rst delete mode 100644 changelog/7135.breaking.rst delete mode 100644 changelog/7143.bugfix.rst delete mode 100644 changelog/7145.bugfix.rst delete mode 100644 changelog/7150.bugfix.rst delete mode 100644 changelog/7159.improvement.rst delete mode 100644 changelog/7180.bugfix.rst delete mode 100644 changelog/7202.doc.rst delete mode 100644 changelog/7210.deprecation.rst delete mode 100644 changelog/7215.bugfix.rst delete mode 100644 changelog/7224.breaking.rst delete mode 100644 changelog/7226.breaking.rst delete mode 100644 changelog/7233.doc.rst delete mode 100644 changelog/7245.feature.rst delete mode 100644 changelog/7253.bugfix.rst delete mode 100644 changelog/7264.improvement.rst delete mode 100644 changelog/7291.trivial.rst delete mode 100644 changelog/7295.trivial.rst delete mode 100644 changelog/7305.feature.rst delete mode 100644 changelog/7345.doc.rst delete mode 100644 changelog/7346.feature.rst delete mode 100644 changelog/7348.improvement.rst delete mode 100644 changelog/7356.trivial.rst delete mode 100644 changelog/7357.trivial.rst delete mode 100644 changelog/7360.bugfix.rst delete mode 100644 changelog/7383.bugfix.rst delete mode 100644 changelog/7385.improvement.rst delete mode 100644 changelog/7418.breaking.rst delete mode 100644 changelog/7438.breaking.rst create mode 100644 doc/en/announce/release-6.0.0rc1.rst diff --git a/changelog/1120.bugfix.rst b/changelog/1120.bugfix.rst deleted file mode 100644 index 95e74fa75..000000000 --- a/changelog/1120.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix issue where directories from tmpdir are not removed properly when multiple instances of pytest are running in parallel. diff --git a/changelog/1316.breaking.rst b/changelog/1316.breaking.rst deleted file mode 100644 index 4c01de728..000000000 --- a/changelog/1316.breaking.rst +++ /dev/null @@ -1 +0,0 @@ -``TestReport.longrepr`` is now always an instance of ``ReprExceptionInfo``. Previously it was a ``str`` when a test failed with ``pytest.fail(..., pytrace=False)``. diff --git a/changelog/1556.feature.rst b/changelog/1556.feature.rst deleted file mode 100644 index 402e772e6..000000000 --- a/changelog/1556.feature.rst +++ /dev/null @@ -1,17 +0,0 @@ -pytest now supports ``pyproject.toml`` files for configuration. - -The configuration options is similar to the one available in other formats, but must be defined -in a ``[tool.pytest.ini_options]`` table to be picked up by pytest: - -.. code-block:: toml - - # pyproject.toml - [tool.pytest.ini_options] - minversion = "6.0" - addopts = "-ra -q" - testpaths = [ - "tests", - "integration", - ] - -More information can be found `in the docs `__. diff --git a/changelog/3342.feature.rst b/changelog/3342.feature.rst deleted file mode 100644 index aef7e2b04..000000000 --- a/changelog/3342.feature.rst +++ /dev/null @@ -1,10 +0,0 @@ -pytest now includes inline type annotations and exposes them to user programs. -Most of the user-facing API is covered, as well as internal code. - -If you are running a type checker such as mypy on your tests, you may start -noticing type errors indicating incorrect usage. If you run into an error that -you believe to be incorrect, please let us know in an issue. - -The types were developed against mypy version 0.780. Older versions may work, -but we recommend using at least this version. Other type checkers may work as -well, but they are not officially verified to work by pytest yet. diff --git a/changelog/4049.feature.rst b/changelog/4049.feature.rst deleted file mode 100644 index 4073589b0..000000000 --- a/changelog/4049.feature.rst +++ /dev/null @@ -1,3 +0,0 @@ -Introduced a new hook named `pytest_warning_recorded` to convey information about warnings captured by the internal `pytest` warnings plugin. - -This hook is meant to replace `pytest_warning_captured`, which will be removed in a future release. diff --git a/changelog/4375.improvement.rst b/changelog/4375.improvement.rst deleted file mode 100644 index 0c9a7f3e6..000000000 --- a/changelog/4375.improvement.rst +++ /dev/null @@ -1,3 +0,0 @@ -The ``pytest`` command now supresses the ``BrokenPipeError`` error message that -is printed to stderr when the output of ``pytest`` is piped and and the pipe is -closed by the piped-to program (common examples are ``less`` and ``head``). diff --git a/changelog/4391.improvement.rst b/changelog/4391.improvement.rst deleted file mode 100644 index e7e4090f1..000000000 --- a/changelog/4391.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -Improved precision of test durations measurement. ``CallInfo`` items now have a new ``.duration`` attribute, created using ``time.perf_counter()``. This attribute is used to fill the ``.duration`` attribute, which is more accurate than the previous ``.stop - .start`` (as these are based on ``time.time()``). diff --git a/changelog/4583.bugfix.rst b/changelog/4583.bugfix.rst deleted file mode 100644 index f0a820303..000000000 --- a/changelog/4583.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Prevent crashing and provide a user-friendly error when a marker expression (-m) invoking of eval() raises any exception. diff --git a/changelog/4675.improvement.rst b/changelog/4675.improvement.rst deleted file mode 100644 index c90cd3591..000000000 --- a/changelog/4675.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -Rich comparison for dataclasses and `attrs`-classes is now recursive. diff --git a/changelog/4677.bugfix.rst b/changelog/4677.bugfix.rst deleted file mode 100644 index 6b7d2cf17..000000000 --- a/changelog/4677.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -The path shown in the summary report for SKIPPED tests is now always relative. Previously it was sometimes absolute. diff --git a/changelog/5456.bugfix.rst b/changelog/5456.bugfix.rst deleted file mode 100644 index 176807570..000000000 --- a/changelog/5456.bugfix.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix a possible race condition when trying to remove lock files used to control access to folders -created by ``tmp_path`` and ``tmpdir``. diff --git a/changelog/5965.breaking.rst b/changelog/5965.breaking.rst deleted file mode 100644 index 3ecb9486a..000000000 --- a/changelog/5965.breaking.rst +++ /dev/null @@ -1,9 +0,0 @@ -symlinks are no longer resolved during collection and matching `conftest.py` files with test file paths. - -Resolving symlinks for the current directory and during collection was introduced as a bugfix in 3.9.0, but it actually is a new feature which had unfortunate consequences in Windows and surprising results in other platforms. - -The team decided to step back on resolving symlinks at all, planning to review this in the future with a more solid solution (see discussion in -`#6523 `__ for details). - -This might break test suites which made use of this feature; the fix is to create a symlink -for the entire test tree, and not only to partial files/tress as it was possible previously. diff --git a/changelog/6240.bugfix.rst b/changelog/6240.bugfix.rst deleted file mode 100644 index b5f5844ec..000000000 --- a/changelog/6240.bugfix.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fixes an issue where logging during collection step caused duplication of log -messages to stderr. diff --git a/changelog/6285.feature.rst b/changelog/6285.feature.rst deleted file mode 100644 index bac353c86..000000000 --- a/changelog/6285.feature.rst +++ /dev/null @@ -1,2 +0,0 @@ -Exposed the `pytest.FixtureLookupError` exception which is raised by `request.getfixturevalue()` -(where `request` is a `FixtureRequest` fixture) when a fixture with the given name cannot be returned. diff --git a/changelog/6428.bugfix.rst b/changelog/6428.bugfix.rst deleted file mode 100644 index 581b2b7ce..000000000 --- a/changelog/6428.bugfix.rst +++ /dev/null @@ -1,2 +0,0 @@ -Paths appearing in error messages are now correct in case the current working directory has -changed since the start of the session. diff --git a/changelog/6433.feature.rst b/changelog/6433.feature.rst deleted file mode 100644 index c331b0f58..000000000 --- a/changelog/6433.feature.rst +++ /dev/null @@ -1,10 +0,0 @@ -If an error is encountered while formatting the message in a logging call, for -example ``logging.warning("oh no!: %s: %s", "first")`` (a second argument is -missing), pytest now propagates the error, likely causing the test to fail. - -Previously, such a mistake would cause an error to be printed to stderr, which -is not displayed by default for passing tests. This change makes the mistake -visible during testing. - -You may supress this behavior temporarily or permanently by setting -``logging.raiseExceptions = False``. diff --git a/changelog/6471.feature.rst b/changelog/6471.feature.rst deleted file mode 100644 index 28457b9f5..000000000 --- a/changelog/6471.feature.rst +++ /dev/null @@ -1,4 +0,0 @@ -New command-line flags: - -* `--no-header`: disables the initial header, including platform, version, and plugins. -* `--no-summary`: disables the final test summary, including warnings. diff --git a/changelog/6505.breaking.rst b/changelog/6505.breaking.rst deleted file mode 100644 index 164b69485..000000000 --- a/changelog/6505.breaking.rst +++ /dev/null @@ -1,20 +0,0 @@ -``Testdir.run().parseoutcomes()`` now always returns the parsed nouns in plural form. - -Originally ``parseoutcomes()`` would always returns the nouns in plural form, but a change -meant to improve the terminal summary by using singular form single items (``1 warning`` or ``1 error``) -caused an unintended regression by changing the keys returned by ``parseoutcomes()``. - -Now the API guarantees to always return the plural form, so calls like this: - -.. code-block:: python - - result = testdir.runpytest() - result.assert_outcomes(error=1) - -Need to be changed to: - - -.. code-block:: python - - result = testdir.runpytest() - result.assert_outcomes(errors=1) diff --git a/changelog/6755.bugfix.rst b/changelog/6755.bugfix.rst deleted file mode 100644 index 8077baa4f..000000000 --- a/changelog/6755.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Support deleting paths longer than 260 characters on windows created inside tmpdir. diff --git a/changelog/6817.improvement.rst b/changelog/6817.improvement.rst deleted file mode 100644 index 8d7e30d34..000000000 --- a/changelog/6817.improvement.rst +++ /dev/null @@ -1,2 +0,0 @@ -Explicit new-lines in help texts of command-line options are preserved, allowing plugins better control -of the help displayed to users. diff --git a/changelog/6856.feature.rst b/changelog/6856.feature.rst deleted file mode 100644 index 36892fa21..000000000 --- a/changelog/6856.feature.rst +++ /dev/null @@ -1,3 +0,0 @@ -A warning is now shown when an unknown key is read from a config INI file. - -The `--strict-config` flag has been added to treat these warnings as errors. diff --git a/changelog/6871.bugfix.rst b/changelog/6871.bugfix.rst deleted file mode 100644 index fe69c7509..000000000 --- a/changelog/6871.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix crash with captured output when using the :fixture:`capsysbinary fixture `. diff --git a/changelog/6903.breaking.rst b/changelog/6903.breaking.rst deleted file mode 100644 index a074a4ffe..000000000 --- a/changelog/6903.breaking.rst +++ /dev/null @@ -1,2 +0,0 @@ -The ``os.dup()`` function is now assumed to exist. We are not aware of any -supported Python 3 implementations which do not provide it. diff --git a/changelog/6906.feature.rst b/changelog/6906.feature.rst deleted file mode 100644 index 3e1fe3ef1..000000000 --- a/changelog/6906.feature.rst +++ /dev/null @@ -1 +0,0 @@ -Added `--code-highlight` command line option to enable/disable code highlighting in terminal output. diff --git a/changelog/6909.bugfix.rst b/changelog/6909.bugfix.rst deleted file mode 100644 index 32edc4974..000000000 --- a/changelog/6909.bugfix.rst +++ /dev/null @@ -1,3 +0,0 @@ -Revert the change introduced by `#6330 `_, which required all arguments to ``@pytest.mark.parametrize`` to be explicitly defined in the function signature. - -The intention of the original change was to remove what was expected to be an unintended/surprising behavior, but it turns out many people relied on it, so the restriction has been reverted. diff --git a/changelog/6910.bugfix.rst b/changelog/6910.bugfix.rst deleted file mode 100644 index 713824998..000000000 --- a/changelog/6910.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix crash when plugins return an unknown stats while using the ``--reportlog`` option. diff --git a/changelog/6924.bugfix.rst b/changelog/6924.bugfix.rst deleted file mode 100644 index 7283370a0..000000000 --- a/changelog/6924.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Ensure a ``unittest.IsolatedAsyncioTestCase`` is actually awaited. diff --git a/changelog/6925.bugfix.rst b/changelog/6925.bugfix.rst deleted file mode 100644 index ed7e99b5d..000000000 --- a/changelog/6925.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix TerminalRepr instances to be hashable again. diff --git a/changelog/6940.improvement.rst b/changelog/6940.improvement.rst deleted file mode 100644 index ab5fc0d49..000000000 --- a/changelog/6940.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -When using the ``--duration`` option, the terminal message output is now more precise about the number and durations of hidden items. diff --git a/changelog/6947.bugfix.rst b/changelog/6947.bugfix.rst deleted file mode 100644 index 3168df843..000000000 --- a/changelog/6947.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix regression where functions registered with ``TestCase.addCleanup`` were not being called on test failures. diff --git a/changelog/6951.bugfix.rst b/changelog/6951.bugfix.rst deleted file mode 100644 index 984089b3a..000000000 --- a/changelog/6951.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Allow users to still set the deprecated ``TerminalReporter.writer`` attribute. diff --git a/changelog/6956.bugfix.rst b/changelog/6956.bugfix.rst deleted file mode 100644 index a88ef94b6..000000000 --- a/changelog/6956.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Prevent pytest from printing ConftestImportFailure traceback to stdout. diff --git a/changelog/6981.deprecation.rst b/changelog/6981.deprecation.rst deleted file mode 100644 index ac32706fa..000000000 --- a/changelog/6981.deprecation.rst +++ /dev/null @@ -1 +0,0 @@ -Deprecate the ``pytest.collect`` module as it's just aliases into ``pytest``. diff --git a/changelog/6991.bugfix.rst b/changelog/6991.bugfix.rst deleted file mode 100644 index 879354e25..000000000 --- a/changelog/6991.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix regressions with `--lf` filtering too much since pytest 5.4. diff --git a/changelog/6991.improvement.rst b/changelog/6991.improvement.rst deleted file mode 100644 index ec08b66c2..000000000 --- a/changelog/6991.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -Collected files are displayed after any reports from hooks, e.g. the status from ``--lf``. diff --git a/changelog/6992.bugfix.rst b/changelog/6992.bugfix.rst deleted file mode 100644 index 2c9b0f89e..000000000 --- a/changelog/6992.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Revert "tmpdir: clean up indirection via config for factories" #6767 as it breaks pytest-xdist. diff --git a/changelog/7035.trivial.rst b/changelog/7035.trivial.rst deleted file mode 100644 index 076cb4b4b..000000000 --- a/changelog/7035.trivial.rst +++ /dev/null @@ -1,2 +0,0 @@ -The ``originalname`` attribute of ``_pytest.python.Function`` now defaults to ``name`` if not -provided explicitly, and is always set. diff --git a/changelog/7040.breaking.rst b/changelog/7040.breaking.rst deleted file mode 100644 index 897b2c0a9..000000000 --- a/changelog/7040.breaking.rst +++ /dev/null @@ -1,6 +0,0 @@ -``-k`` no longer matches against the names of the directories outside the test session root. - -Also, ``pytest.Package.name`` is now just the name of the directory containing the package's -``__init__.py`` file, instead of the full path. This is consistent with how the other nodes -are named, and also one of the reasons why ``-k`` would match against any directory containing -the test suite. diff --git a/changelog/7061.bugfix.rst b/changelog/7061.bugfix.rst deleted file mode 100644 index 7e6d36c2f..000000000 --- a/changelog/7061.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -When a yielding fixture fails to yield a value, report a test setup error instead of crashing. diff --git a/changelog/7076.bugfix.rst b/changelog/7076.bugfix.rst deleted file mode 100644 index 5d9749c69..000000000 --- a/changelog/7076.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -The path of file skipped by ``@pytest.mark.skip`` in the SKIPPED report is now relative to invocation directory. Previously it was relative to root directory. diff --git a/changelog/7091.improvement.rst b/changelog/7091.improvement.rst deleted file mode 100644 index 72f17c5e4..000000000 --- a/changelog/7091.improvement.rst +++ /dev/null @@ -1,4 +0,0 @@ -When ``fd`` capturing is used, through ``--capture=fd`` or the ``capfd`` and -``capfdbinary`` fixtures, and the file descriptor (0, 1, 2) cannot be -duplicated, FD capturing is still performed. Previously, direct writes to the -file descriptors would fail or be lost in this case. diff --git a/changelog/7097.deprecation.rst b/changelog/7097.deprecation.rst deleted file mode 100644 index ed9779e1f..000000000 --- a/changelog/7097.deprecation.rst +++ /dev/null @@ -1,6 +0,0 @@ -The ``pytest._fillfuncargs`` function is now deprecated. This function was kept -for backward compatibility with an older plugin. - -It's functionality is not meant to be used directly, but if you must replace -it, use `function._request._fillfixtures()` instead, though note this is not -a public API and may break in the future. diff --git a/changelog/7110.bugfix.rst b/changelog/7110.bugfix.rst deleted file mode 100644 index 935f6ea3c..000000000 --- a/changelog/7110.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed regression: ``asyncbase.TestCase`` tests are executed correctly again. diff --git a/changelog/7119.improvement.rst b/changelog/7119.improvement.rst deleted file mode 100644 index 6cef98836..000000000 --- a/changelog/7119.improvement.rst +++ /dev/null @@ -1,2 +0,0 @@ -Exit with an error if the ``--basetemp`` argument is empty, the current working directory or parent directory of it. -This is done to protect against accidental data loss, as any directory passed to this argument is cleared. diff --git a/changelog/7122.breaking.rst b/changelog/7122.breaking.rst deleted file mode 100644 index 7fe329c9f..000000000 --- a/changelog/7122.breaking.rst +++ /dev/null @@ -1,3 +0,0 @@ -Expressions given to the ``-m`` and ``-k`` options are no longer evaluated using Python's ``eval()``. -The format supports ``or``, ``and``, ``not``, parenthesis and general identifiers to match against. -Python constants, keywords or other operators are no longer evaluated differently. diff --git a/changelog/7126.bugfix.rst b/changelog/7126.bugfix.rst deleted file mode 100644 index 1a85e8997..000000000 --- a/changelog/7126.bugfix.rst +++ /dev/null @@ -1,2 +0,0 @@ -``--setup-show`` now doesn't raise an error when a bytes value is used as a ``parametrize`` -parameter when Python is called with the ``-bb`` flag. diff --git a/changelog/7128.improvement.rst b/changelog/7128.improvement.rst deleted file mode 100644 index 9d24d567a..000000000 --- a/changelog/7128.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -`pytest --version` now displays just the pytest version, while `pytest --version --version` displays more verbose information including plugins. diff --git a/changelog/7133.improvement.rst b/changelog/7133.improvement.rst deleted file mode 100644 index b537d3e5d..000000000 --- a/changelog/7133.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -``caplog.set_level()`` will now override any :confval:`log_level` set via the CLI or ``.ini``. diff --git a/changelog/7135.breaking.rst b/changelog/7135.breaking.rst deleted file mode 100644 index 4d5df4e40..000000000 --- a/changelog/7135.breaking.rst +++ /dev/null @@ -1,15 +0,0 @@ -Pytest now uses its own ``TerminalWriter`` class instead of using the one from the ``py`` library. -Plugins generally access this class through ``TerminalReporter.writer``, ``TerminalReporter.write()`` -(and similar methods), or ``_pytest.config.create_terminal_writer()``. - -The following breaking changes were made: - -- Output (``write()`` method and others) no longer flush implicitly; the flushing behavior - of the underlying file is respected. To flush explicitly (for example, if you - want output to be shown before an end-of-line is printed), use ``write(flush=True)`` or - ``terminal_writer.flush()``. -- Explicit Windows console support was removed, delegated to the colorama library. -- Support for writing ``bytes`` was removed. -- The ``reline`` method and ``chars_on_current_line`` property were removed. -- The ``stringio`` and ``encoding`` arguments was removed. -- Support for passing a callable instead of a file was removed. diff --git a/changelog/7143.bugfix.rst b/changelog/7143.bugfix.rst deleted file mode 100644 index abf47dd0c..000000000 --- a/changelog/7143.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix ``File.from_constructor`` so it forwards extra keyword arguments to the constructor. diff --git a/changelog/7145.bugfix.rst b/changelog/7145.bugfix.rst deleted file mode 100644 index def237dc0..000000000 --- a/changelog/7145.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Classes with broken ``__getattribute__`` methods are displayed correctly during failures. diff --git a/changelog/7150.bugfix.rst b/changelog/7150.bugfix.rst deleted file mode 100644 index 42cf5c7d2..000000000 --- a/changelog/7150.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Prevent hiding the underlying exception when ``ConfTestImportFailure`` is raised. diff --git a/changelog/7159.improvement.rst b/changelog/7159.improvement.rst deleted file mode 100644 index c5f51a7b7..000000000 --- a/changelog/7159.improvement.rst +++ /dev/null @@ -1,3 +0,0 @@ -When the ``caplog`` fixture is used to change the log level for capturing, -using ``caplog.set_level()`` or ``caplog.at_level()``, it no longer affects -the level of logs that are shown in the "Captured log report" report section. diff --git a/changelog/7180.bugfix.rst b/changelog/7180.bugfix.rst deleted file mode 100644 index d2dd55e9b..000000000 --- a/changelog/7180.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix ``_is_setup_py`` for files encoded differently than locale. diff --git a/changelog/7202.doc.rst b/changelog/7202.doc.rst deleted file mode 100644 index 143f28d40..000000000 --- a/changelog/7202.doc.rst +++ /dev/null @@ -1 +0,0 @@ -The development guide now links to the contributing section of the docs and 'RELEASING.rst' on GitHub. diff --git a/changelog/7210.deprecation.rst b/changelog/7210.deprecation.rst deleted file mode 100644 index 3e1350eaa..000000000 --- a/changelog/7210.deprecation.rst +++ /dev/null @@ -1,5 +0,0 @@ -The special ``-k '-expr'`` syntax to ``-k`` is deprecated. Use ``-k 'not expr'`` -instead. - -The special ``-k 'expr:'`` syntax to ``-k`` is deprecated. Please open an issue -if you use this and want a replacement. diff --git a/changelog/7215.bugfix.rst b/changelog/7215.bugfix.rst deleted file mode 100644 index 815149132..000000000 --- a/changelog/7215.bugfix.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix regression where running with ``--pdb`` would call the ``tearDown`` methods of ``unittest.TestCase`` -subclasses for skipped tests. diff --git a/changelog/7224.breaking.rst b/changelog/7224.breaking.rst deleted file mode 100644 index 32592695a..000000000 --- a/changelog/7224.breaking.rst +++ /dev/null @@ -1,4 +0,0 @@ -The `item.catch_log_handler` and `item.catch_log_handlers` attributes, set by the -logging plugin and never meant to be public , are no longer available. - -The deprecated ``--no-print-logs`` option is removed. Use ``--show-capture`` instead. diff --git a/changelog/7226.breaking.rst b/changelog/7226.breaking.rst deleted file mode 100644 index bf1c443fc..000000000 --- a/changelog/7226.breaking.rst +++ /dev/null @@ -1 +0,0 @@ -Removed the unused ``args`` parameter from ``pytest.Function.__init__``. diff --git a/changelog/7233.doc.rst b/changelog/7233.doc.rst deleted file mode 100644 index c57f4d61f..000000000 --- a/changelog/7233.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Add a note about ``--strict`` and ``--strict-markers`` and the preference for the latter one. diff --git a/changelog/7245.feature.rst b/changelog/7245.feature.rst deleted file mode 100644 index 05c3a6c04..000000000 --- a/changelog/7245.feature.rst +++ /dev/null @@ -1,14 +0,0 @@ -New ``--import-mode=importlib`` option that uses `importlib `__ to import test modules. - -Traditionally pytest used ``__import__`` while changing ``sys.path`` to import test modules (which -also changes ``sys.modules`` as a side-effect), which works but has a number of drawbacks, like requiring test modules -that don't live in packages to have unique names (as they need to reside under a unique name in ``sys.modules``). - -``--import-mode=importlib`` uses more fine grained import mechanisms from ``importlib`` which don't -require pytest to change ``sys.path`` or ``sys.modules`` at all, eliminating much of the drawbacks -of the previous mode. - -We intend to make ``--import-mode=importlib`` the default in future versions, so users are encouraged -to try the new mode and provide feedback (both positive or negative) in issue `#7245 `__. - -You can read more about this option in `the documentation `__. diff --git a/changelog/7253.bugfix.rst b/changelog/7253.bugfix.rst deleted file mode 100644 index e73ef663f..000000000 --- a/changelog/7253.bugfix.rst +++ /dev/null @@ -1,3 +0,0 @@ -When using ``pytest.fixture`` on a function directly, as in ``pytest.fixture(func)``, -if the ``autouse`` or ``params`` arguments are also passed, the function is no longer -ignored, but is marked as a fixture. diff --git a/changelog/7264.improvement.rst b/changelog/7264.improvement.rst deleted file mode 100644 index 035745c4d..000000000 --- a/changelog/7264.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -The dependency on the ``wcwidth`` package has been removed. diff --git a/changelog/7291.trivial.rst b/changelog/7291.trivial.rst deleted file mode 100644 index 8f41528aa..000000000 --- a/changelog/7291.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -Replaced ``py.iniconfig`` with `iniconfig `__. diff --git a/changelog/7295.trivial.rst b/changelog/7295.trivial.rst deleted file mode 100644 index 113a7ee60..000000000 --- a/changelog/7295.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -``src/_pytest/config/__init__.py`` now uses the ``warnings`` module to report warnings instead of ``sys.stderr.write``. diff --git a/changelog/7305.feature.rst b/changelog/7305.feature.rst deleted file mode 100644 index 96b7f72ee..000000000 --- a/changelog/7305.feature.rst +++ /dev/null @@ -1 +0,0 @@ -New ``required_plugins`` configuration option allows the user to specify a list of plugins required for pytest to run. An error is raised if any required plugins are not found when running pytest. diff --git a/changelog/7345.doc.rst b/changelog/7345.doc.rst deleted file mode 100644 index 4c7234f41..000000000 --- a/changelog/7345.doc.rst +++ /dev/null @@ -1 +0,0 @@ -Explain indirect parametrization and markers for fixtures diff --git a/changelog/7346.feature.rst b/changelog/7346.feature.rst deleted file mode 100644 index fef0bbb78..000000000 --- a/changelog/7346.feature.rst +++ /dev/null @@ -1 +0,0 @@ -Version information as defined by `PEP 440 `_ may now be included when providing plugins to the ``required_plugins`` configuration option. diff --git a/changelog/7348.improvement.rst b/changelog/7348.improvement.rst deleted file mode 100644 index 714892e6e..000000000 --- a/changelog/7348.improvement.rst +++ /dev/null @@ -1 +0,0 @@ -Improve recursive diff report for comparison asserts on dataclasses / attrs. diff --git a/changelog/7356.trivial.rst b/changelog/7356.trivial.rst deleted file mode 100644 index d280e2291..000000000 --- a/changelog/7356.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -Remove last internal uses of deprecated "slave" term from old pytest-xdist. diff --git a/changelog/7357.trivial.rst b/changelog/7357.trivial.rst deleted file mode 100644 index f0f9d035d..000000000 --- a/changelog/7357.trivial.rst +++ /dev/null @@ -1 +0,0 @@ -py>=1.8.2 is now required. diff --git a/changelog/7360.bugfix.rst b/changelog/7360.bugfix.rst deleted file mode 100644 index b84ce4614..000000000 --- a/changelog/7360.bugfix.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix possibly incorrect evaluation of string expressions passed to ``pytest.mark.skipif`` and ``pytest.mark.xfail``, -in rare circumstances where the exact same string is used but refers to different global values. diff --git a/changelog/7383.bugfix.rst b/changelog/7383.bugfix.rst deleted file mode 100644 index d43106880..000000000 --- a/changelog/7383.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed exception causes all over the codebase, i.e. use `raise new_exception from old_exception` when wrapping an exception. diff --git a/changelog/7385.improvement.rst b/changelog/7385.improvement.rst deleted file mode 100644 index c02fee5da..000000000 --- a/changelog/7385.improvement.rst +++ /dev/null @@ -1,13 +0,0 @@ -``--junitxml`` now includes the exception cause in the ``message`` XML attribute for failures during setup and teardown. - -Previously: - -.. code-block:: xml - - - -Now: - -.. code-block:: xml - - diff --git a/changelog/7418.breaking.rst b/changelog/7418.breaking.rst deleted file mode 100644 index 23f60da37..000000000 --- a/changelog/7418.breaking.rst +++ /dev/null @@ -1,2 +0,0 @@ -Remove the `pytest_doctest_prepare_content` hook specification. This hook -hasn't been triggered by pytest for at least 10 years. diff --git a/changelog/7438.breaking.rst b/changelog/7438.breaking.rst deleted file mode 100644 index 5d5d239fc..000000000 --- a/changelog/7438.breaking.rst +++ /dev/null @@ -1,11 +0,0 @@ -Some changes were made to the internal ``_pytest._code.source``, listed here -for the benefit of plugin authors who may be using it: - -- The ``deindent`` argument to ``Source()`` has been removed, now it is always true. -- Support for zero or multiple arguments to ``Source()`` has been removed. -- Support for comparing ``Source`` with an ``str`` has been removed. -- The methods ``Source.isparseable()`` and ``Source.putaround()`` have been removed. -- The method ``Source.compile()`` and function ``_pytest._code.compile()`` have - been removed; use plain ``compile()`` instead. -- The function ``_pytest._code.source.getsource()`` has been removed; use - ``Source()`` directly instead. diff --git a/doc/en/announce/index.rst b/doc/en/announce/index.rst index 4405e6fe0..31deaad71 100644 --- a/doc/en/announce/index.rst +++ b/doc/en/announce/index.rst @@ -6,6 +6,7 @@ Release announcements :maxdepth: 2 + release-6.0.0rc1 release-5.4.3 release-5.4.2 release-5.4.1 diff --git a/doc/en/announce/release-6.0.0rc1.rst b/doc/en/announce/release-6.0.0rc1.rst new file mode 100644 index 000000000..32193d5c1 --- /dev/null +++ b/doc/en/announce/release-6.0.0rc1.rst @@ -0,0 +1,69 @@ +pytest-6.0.0rc1 +======================================= + +pytest 6.0.0rc1 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: + +* Alfredo Deza +* Andreas Maier +* Andrew +* Anthony Sottile +* ArtyomKaltovich +* Bruno Oliveira +* Claire Cecil +* Curt J. Sampson +* Daniel +* Daniel Hahler +* Danny Sepler +* David Diaz Barquero +* Fabio Zadrozny +* Felix Nieuwenhuizen +* Florian Bruhin +* Florian Dahlitz +* Gleb Nikonorov +* Hugo van Kemenade +* Hunter Richards +* Katarzyna +* Katarzyna Król +* Katrin Leinweber +* Keri Volans +* Lewis Belcher +* Lukas Geiger +* Martin Michlmayr +* Mattwmaster58 +* Maximilian Cosmo Sitter +* Nikolay Kondratyev +* Pavel Karateev +* Paweł Wilczyński +* Prashant Anand +* Ram Rachum +* Ran Benita +* Ronny Pfannschmidt +* Ruaridh Williamson +* Simon K +* Tim Hoffmann +* Tor Colvin +* Vlad-Radz +* Xinbin Huang +* Zac Hatfield-Dodds +* Zac-HD +* earonesty +* gaurav dhameeja +* gdhameeja +* ibriquem +* mcsitter +* piotrhm +* smarie +* symonk +* xuiqzy + + +Happy testing, +The pytest Development Team diff --git a/doc/en/assert.rst b/doc/en/assert.rst index 87c79720f..e39da6e8a 100644 --- a/doc/en/assert.rst +++ b/doc/en/assert.rst @@ -31,7 +31,7 @@ you will see the return value of the function call: $ pytest test_assert1.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 1 item @@ -188,7 +188,7 @@ if you run this module: $ pytest test_assert2.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 1 item diff --git a/doc/en/cache.rst b/doc/en/cache.rst index fa51bd5ee..076d4b197 100644 --- a/doc/en/cache.rst +++ b/doc/en/cache.rst @@ -86,7 +86,7 @@ If you then run it with ``--lf``: $ pytest --lf =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 2 items @@ -133,7 +133,7 @@ of ``FF`` and dots): $ pytest --ff =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 50 items @@ -277,7 +277,7 @@ You can always peek at the content of the cache using the $ pytest --cache-show =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR cachedir: $PYTHON_PREFIX/.pytest_cache @@ -290,19 +290,7 @@ You can always peek at the content of the cache using the 'test_caching.py::test_function': True, 'test_foocompare.py::test_compare': True} cache/nodeids contains: - ['test_assert1.py::test_function', - 'test_assert2.py::test_set_comparison', - 'test_foocompare.py::test_compare', - 'test_50.py::test_num[0]', - 'test_50.py::test_num[1]', - 'test_50.py::test_num[2]', - 'test_50.py::test_num[3]', - 'test_50.py::test_num[4]', - 'test_50.py::test_num[5]', - 'test_50.py::test_num[6]', - 'test_50.py::test_num[7]', - 'test_50.py::test_num[8]', - 'test_50.py::test_num[9]', + ['test_50.py::test_num[0]', 'test_50.py::test_num[10]', 'test_50.py::test_num[11]', 'test_50.py::test_num[12]', @@ -313,6 +301,7 @@ You can always peek at the content of the cache using the 'test_50.py::test_num[17]', 'test_50.py::test_num[18]', 'test_50.py::test_num[19]', + 'test_50.py::test_num[1]', 'test_50.py::test_num[20]', 'test_50.py::test_num[21]', 'test_50.py::test_num[22]', @@ -323,6 +312,7 @@ You can always peek at the content of the cache using the 'test_50.py::test_num[27]', 'test_50.py::test_num[28]', 'test_50.py::test_num[29]', + 'test_50.py::test_num[2]', 'test_50.py::test_num[30]', 'test_50.py::test_num[31]', 'test_50.py::test_num[32]', @@ -333,6 +323,7 @@ You can always peek at the content of the cache using the 'test_50.py::test_num[37]', 'test_50.py::test_num[38]', 'test_50.py::test_num[39]', + 'test_50.py::test_num[3]', 'test_50.py::test_num[40]', 'test_50.py::test_num[41]', 'test_50.py::test_num[42]', @@ -343,7 +334,16 @@ You can always peek at the content of the cache using the 'test_50.py::test_num[47]', 'test_50.py::test_num[48]', 'test_50.py::test_num[49]', - 'test_caching.py::test_function'] + 'test_50.py::test_num[4]', + 'test_50.py::test_num[5]', + 'test_50.py::test_num[6]', + 'test_50.py::test_num[7]', + 'test_50.py::test_num[8]', + 'test_50.py::test_num[9]', + 'test_assert1.py::test_function', + 'test_assert2.py::test_set_comparison', + 'test_caching.py::test_function', + 'test_foocompare.py::test_compare'] cache/stepwise contains: [] example/value contains: @@ -358,7 +358,7 @@ filtering: $ pytest --cache-show example/* =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR cachedir: $PYTHON_PREFIX/.pytest_cache diff --git a/doc/en/capture.rst b/doc/en/capture.rst index 44d3a3bd1..caaebdf81 100644 --- a/doc/en/capture.rst +++ b/doc/en/capture.rst @@ -83,7 +83,7 @@ of the failing function and hide the other one: $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 2 items diff --git a/doc/en/changelog.rst b/doc/en/changelog.rst index ab622ec1e..d6e07c8e4 100644 --- a/doc/en/changelog.rst +++ b/doc/en/changelog.rst @@ -28,6 +28,423 @@ with advance notice in the **Deprecations** section of releases. .. towncrier release notes start +pytest 6.0.0rc1 (2020-07-08) +============================ + +Breaking Changes +---------------- + +- `#1316 `_: ``TestReport.longrepr`` is now always an instance of ``ReprExceptionInfo``. Previously it was a ``str`` when a test failed with ``pytest.fail(..., pytrace=False)``. + + +- `#5965 `_: symlinks are no longer resolved during collection and matching `conftest.py` files with test file paths. + + Resolving symlinks for the current directory and during collection was introduced as a bugfix in 3.9.0, but it actually is a new feature which had unfortunate consequences in Windows and surprising results in other platforms. + + The team decided to step back on resolving symlinks at all, planning to review this in the future with a more solid solution (see discussion in + `#6523 `__ for details). + + This might break test suites which made use of this feature; the fix is to create a symlink + for the entire test tree, and not only to partial files/tress as it was possible previously. + + +- `#6505 `_: ``Testdir.run().parseoutcomes()`` now always returns the parsed nouns in plural form. + + Originally ``parseoutcomes()`` would always returns the nouns in plural form, but a change + meant to improve the terminal summary by using singular form single items (``1 warning`` or ``1 error``) + caused an unintended regression by changing the keys returned by ``parseoutcomes()``. + + Now the API guarantees to always return the plural form, so calls like this: + + .. code-block:: python + + result = testdir.runpytest() + result.assert_outcomes(error=1) + + Need to be changed to: + + + .. code-block:: python + + result = testdir.runpytest() + result.assert_outcomes(errors=1) + + +- `#6903 `_: The ``os.dup()`` function is now assumed to exist. We are not aware of any + supported Python 3 implementations which do not provide it. + + +- `#7040 `_: ``-k`` no longer matches against the names of the directories outside the test session root. + + Also, ``pytest.Package.name`` is now just the name of the directory containing the package's + ``__init__.py`` file, instead of the full path. This is consistent with how the other nodes + are named, and also one of the reasons why ``-k`` would match against any directory containing + the test suite. + + +- `#7122 `_: Expressions given to the ``-m`` and ``-k`` options are no longer evaluated using Python's ``eval()``. + The format supports ``or``, ``and``, ``not``, parenthesis and general identifiers to match against. + Python constants, keywords or other operators are no longer evaluated differently. + + +- `#7135 `_: Pytest now uses its own ``TerminalWriter`` class instead of using the one from the ``py`` library. + Plugins generally access this class through ``TerminalReporter.writer``, ``TerminalReporter.write()`` + (and similar methods), or ``_pytest.config.create_terminal_writer()``. + + The following breaking changes were made: + + - Output (``write()`` method and others) no longer flush implicitly; the flushing behavior + of the underlying file is respected. To flush explicitly (for example, if you + want output to be shown before an end-of-line is printed), use ``write(flush=True)`` or + ``terminal_writer.flush()``. + - Explicit Windows console support was removed, delegated to the colorama library. + - Support for writing ``bytes`` was removed. + - The ``reline`` method and ``chars_on_current_line`` property were removed. + - The ``stringio`` and ``encoding`` arguments was removed. + - Support for passing a callable instead of a file was removed. + + +- `#7224 `_: The `item.catch_log_handler` and `item.catch_log_handlers` attributes, set by the + logging plugin and never meant to be public , are no longer available. + + The deprecated ``--no-print-logs`` option is removed. Use ``--show-capture`` instead. + + +- `#7226 `_: Removed the unused ``args`` parameter from ``pytest.Function.__init__``. + + +- `#7418 `_: Remove the `pytest_doctest_prepare_content` hook specification. This hook + hasn't been triggered by pytest for at least 10 years. + + +- `#7438 `_: Some changes were made to the internal ``_pytest._code.source``, listed here + for the benefit of plugin authors who may be using it: + + - The ``deindent`` argument to ``Source()`` has been removed, now it is always true. + - Support for zero or multiple arguments to ``Source()`` has been removed. + - Support for comparing ``Source`` with an ``str`` has been removed. + - The methods ``Source.isparseable()`` and ``Source.putaround()`` have been removed. + - The method ``Source.compile()`` and function ``_pytest._code.compile()`` have + been removed; use plain ``compile()`` instead. + - The function ``_pytest._code.source.getsource()`` has been removed; use + ``Source()`` directly instead. + + + +Deprecations +------------ + +- `#6981 `_: Deprecate the ``pytest.collect`` module as it's just aliases into ``pytest``. + + +- `#7097 `_: The ``pytest._fillfuncargs`` function is now deprecated. This function was kept + for backward compatibility with an older plugin. + + It's functionality is not meant to be used directly, but if you must replace + it, use `function._request._fillfixtures()` instead, though note this is not + a public API and may break in the future. + + +- `#7210 `_: The special ``-k '-expr'`` syntax to ``-k`` is deprecated. Use ``-k 'not expr'`` + instead. + + The special ``-k 'expr:'`` syntax to ``-k`` is deprecated. Please open an issue + if you use this and want a replacement. + + + +Features +-------- + +- `#1556 `_: pytest now supports ``pyproject.toml`` files for configuration. + + The configuration options is similar to the one available in other formats, but must be defined + in a ``[tool.pytest.ini_options]`` table to be picked up by pytest: + + .. code-block:: toml + + # pyproject.toml + [tool.pytest.ini_options] + minversion = "6.0" + addopts = "-ra -q" + testpaths = [ + "tests", + "integration", + ] + + More information can be found `in the docs `__. + + +- `#3342 `_: pytest now includes inline type annotations and exposes them to user programs. + Most of the user-facing API is covered, as well as internal code. + + If you are running a type checker such as mypy on your tests, you may start + noticing type errors indicating incorrect usage. If you run into an error that + you believe to be incorrect, please let us know in an issue. + + The types were developed against mypy version 0.780. Older versions may work, + but we recommend using at least this version. Other type checkers may work as + well, but they are not officially verified to work by pytest yet. + + +- `#4049 `_: Introduced a new hook named `pytest_warning_recorded` to convey information about warnings captured by the internal `pytest` warnings plugin. + + This hook is meant to replace `pytest_warning_captured`, which will be removed in a future release. + + +- `#6285 `_: Exposed the `pytest.FixtureLookupError` exception which is raised by `request.getfixturevalue()` + (where `request` is a `FixtureRequest` fixture) when a fixture with the given name cannot be returned. + + +- `#6433 `_: If an error is encountered while formatting the message in a logging call, for + example ``logging.warning("oh no!: %s: %s", "first")`` (a second argument is + missing), pytest now propagates the error, likely causing the test to fail. + + Previously, such a mistake would cause an error to be printed to stderr, which + is not displayed by default for passing tests. This change makes the mistake + visible during testing. + + You may supress this behavior temporarily or permanently by setting + ``logging.raiseExceptions = False``. + + +- `#6471 `_: New command-line flags: + + * `--no-header`: disables the initial header, including platform, version, and plugins. + * `--no-summary`: disables the final test summary, including warnings. + + +- `#6856 `_: A warning is now shown when an unknown key is read from a config INI file. + + The `--strict-config` flag has been added to treat these warnings as errors. + + +- `#6906 `_: Added `--code-highlight` command line option to enable/disable code highlighting in terminal output. + + +- `#7245 `_: New ``--import-mode=importlib`` option that uses `importlib `__ to import test modules. + + Traditionally pytest used ``__import__`` while changing ``sys.path`` to import test modules (which + also changes ``sys.modules`` as a side-effect), which works but has a number of drawbacks, like requiring test modules + that don't live in packages to have unique names (as they need to reside under a unique name in ``sys.modules``). + + ``--import-mode=importlib`` uses more fine grained import mechanisms from ``importlib`` which don't + require pytest to change ``sys.path`` or ``sys.modules`` at all, eliminating much of the drawbacks + of the previous mode. + + We intend to make ``--import-mode=importlib`` the default in future versions, so users are encouraged + to try the new mode and provide feedback (both positive or negative) in issue `#7245 `__. + + You can read more about this option in `the documentation `__. + + +- `#7305 `_: New ``required_plugins`` configuration option allows the user to specify a list of plugins required for pytest to run. An error is raised if any required plugins are not found when running pytest. + + +- `#7346 `_: Version information as defined by `PEP 440 `_ may now be included when providing plugins to the ``required_plugins`` configuration option. + + + +Improvements +------------ + +- `#4375 `_: The ``pytest`` command now supresses the ``BrokenPipeError`` error message that + is printed to stderr when the output of ``pytest`` is piped and and the pipe is + closed by the piped-to program (common examples are ``less`` and ``head``). + + +- `#4391 `_: Improved precision of test durations measurement. ``CallInfo`` items now have a new ``.duration`` attribute, created using ``time.perf_counter()``. This attribute is used to fill the ``.duration`` attribute, which is more accurate than the previous ``.stop - .start`` (as these are based on ``time.time()``). + + +- `#4675 `_: Rich comparison for dataclasses and `attrs`-classes is now recursive. + + +- `#6817 `_: Explicit new-lines in help texts of command-line options are preserved, allowing plugins better control + of the help displayed to users. + + +- `#6940 `_: When using the ``--duration`` option, the terminal message output is now more precise about the number and durations of hidden items. + + +- `#6991 `_: Collected files are displayed after any reports from hooks, e.g. the status from ``--lf``. + + +- `#7091 `_: When ``fd`` capturing is used, through ``--capture=fd`` or the ``capfd`` and + ``capfdbinary`` fixtures, and the file descriptor (0, 1, 2) cannot be + duplicated, FD capturing is still performed. Previously, direct writes to the + file descriptors would fail or be lost in this case. + + +- `#7119 `_: Exit with an error if the ``--basetemp`` argument is empty, the current working directory or parent directory of it. + This is done to protect against accidental data loss, as any directory passed to this argument is cleared. + + +- `#7128 `_: `pytest --version` now displays just the pytest version, while `pytest --version --version` displays more verbose information including plugins. + + +- `#7133 `_: ``caplog.set_level()`` will now override any :confval:`log_level` set via the CLI or ``.ini``. + + +- `#7159 `_: When the ``caplog`` fixture is used to change the log level for capturing, + using ``caplog.set_level()`` or ``caplog.at_level()``, it no longer affects + the level of logs that are shown in the "Captured log report" report section. + + +- `#7264 `_: The dependency on the ``wcwidth`` package has been removed. + + +- `#7348 `_: Improve recursive diff report for comparison asserts on dataclasses / attrs. + + +- `#7385 `_: ``--junitxml`` now includes the exception cause in the ``message`` XML attribute for failures during setup and teardown. + + Previously: + + .. code-block:: xml + + + + Now: + + .. code-block:: xml + + + + + +Bug Fixes +--------- + +- `#1120 `_: Fix issue where directories from tmpdir are not removed properly when multiple instances of pytest are running in parallel. + + +- `#4583 `_: Prevent crashing and provide a user-friendly error when a marker expression (-m) invoking of eval() raises any exception. + + +- `#4677 `_: The path shown in the summary report for SKIPPED tests is now always relative. Previously it was sometimes absolute. + + +- `#5456 `_: Fix a possible race condition when trying to remove lock files used to control access to folders + created by ``tmp_path`` and ``tmpdir``. + + +- `#6240 `_: Fixes an issue where logging during collection step caused duplication of log + messages to stderr. + + +- `#6428 `_: Paths appearing in error messages are now correct in case the current working directory has + changed since the start of the session. + + +- `#6755 `_: Support deleting paths longer than 260 characters on windows created inside tmpdir. + + +- `#6871 `_: Fix crash with captured output when using the :fixture:`capsysbinary fixture `. + + +- `#6909 `_: Revert the change introduced by `#6330 `_, which required all arguments to ``@pytest.mark.parametrize`` to be explicitly defined in the function signature. + + The intention of the original change was to remove what was expected to be an unintended/surprising behavior, but it turns out many people relied on it, so the restriction has been reverted. + + +- `#6910 `_: Fix crash when plugins return an unknown stats while using the ``--reportlog`` option. + + +- `#6924 `_: Ensure a ``unittest.IsolatedAsyncioTestCase`` is actually awaited. + + +- `#6925 `_: Fix TerminalRepr instances to be hashable again. + + +- `#6947 `_: Fix regression where functions registered with ``TestCase.addCleanup`` were not being called on test failures. + + +- `#6951 `_: Allow users to still set the deprecated ``TerminalReporter.writer`` attribute. + + +- `#6956 `_: Prevent pytest from printing ConftestImportFailure traceback to stdout. + + +- `#6991 `_: Fix regressions with `--lf` filtering too much since pytest 5.4. + + +- `#6992 `_: Revert "tmpdir: clean up indirection via config for factories" #6767 as it breaks pytest-xdist. + + +- `#7061 `_: When a yielding fixture fails to yield a value, report a test setup error instead of crashing. + + +- `#7076 `_: The path of file skipped by ``@pytest.mark.skip`` in the SKIPPED report is now relative to invocation directory. Previously it was relative to root directory. + + +- `#7110 `_: Fixed regression: ``asyncbase.TestCase`` tests are executed correctly again. + + +- `#7126 `_: ``--setup-show`` now doesn't raise an error when a bytes value is used as a ``parametrize`` + parameter when Python is called with the ``-bb`` flag. + + +- `#7143 `_: Fix ``File.from_constructor`` so it forwards extra keyword arguments to the constructor. + + +- `#7145 `_: Classes with broken ``__getattribute__`` methods are displayed correctly during failures. + + +- `#7150 `_: Prevent hiding the underlying exception when ``ConfTestImportFailure`` is raised. + + +- `#7180 `_: Fix ``_is_setup_py`` for files encoded differently than locale. + + +- `#7215 `_: Fix regression where running with ``--pdb`` would call the ``tearDown`` methods of ``unittest.TestCase`` + subclasses for skipped tests. + + +- `#7253 `_: When using ``pytest.fixture`` on a function directly, as in ``pytest.fixture(func)``, + if the ``autouse`` or ``params`` arguments are also passed, the function is no longer + ignored, but is marked as a fixture. + + +- `#7360 `_: Fix possibly incorrect evaluation of string expressions passed to ``pytest.mark.skipif`` and ``pytest.mark.xfail``, + in rare circumstances where the exact same string is used but refers to different global values. + + +- `#7383 `_: Fixed exception causes all over the codebase, i.e. use `raise new_exception from old_exception` when wrapping an exception. + + + +Improved Documentation +---------------------- + +- `#7202 `_: The development guide now links to the contributing section of the docs and 'RELEASING.rst' on GitHub. + + +- `#7233 `_: Add a note about ``--strict`` and ``--strict-markers`` and the preference for the latter one. + + +- `#7345 `_: Explain indirect parametrization and markers for fixtures + + + +Trivial/Internal Changes +------------------------ + +- `#7035 `_: The ``originalname`` attribute of ``_pytest.python.Function`` now defaults to ``name`` if not + provided explicitly, and is always set. + + +- `#7291 `_: Replaced ``py.iniconfig`` with `iniconfig `__. + + +- `#7295 `_: ``src/_pytest/config/__init__.py`` now uses the ``warnings`` module to report warnings instead of ``sys.stderr.write``. + + +- `#7356 `_: Remove last internal uses of deprecated "slave" term from old pytest-xdist. + + +- `#7357 `_: py>=1.8.2 is now required. + + pytest 5.4.3 (2020-06-02) ========================= diff --git a/doc/en/doctest.rst b/doc/en/doctest.rst index a85ac3d64..bb96ee409 100644 --- a/doc/en/doctest.rst +++ b/doc/en/doctest.rst @@ -29,7 +29,7 @@ then you can just invoke ``pytest`` directly: $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 1 item @@ -58,7 +58,7 @@ and functions, including from test modules: $ pytest --doctest-modules =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 2 items diff --git a/doc/en/example/markers.rst b/doc/en/example/markers.rst index 55dd8af23..454304679 100644 --- a/doc/en/example/markers.rst +++ b/doc/en/example/markers.rst @@ -45,7 +45,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-5.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collecting ... collected 4 items / 3 deselected / 1 selected @@ -60,7 +60,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-5.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collecting ... collected 4 items / 1 deselected / 3 selected @@ -82,7 +82,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-5.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collecting ... collected 1 item @@ -97,7 +97,7 @@ You can also select on the class: $ pytest -v test_server.py::TestClass =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collecting ... collected 1 item @@ -112,7 +112,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-5.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collecting ... collected 2 items @@ -156,7 +156,7 @@ The expression matching is now case-insensitive. $ pytest -v -k http # running with the above defined example module =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collecting ... collected 4 items / 3 deselected / 1 selected @@ -171,7 +171,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-5.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collecting ... collected 4 items / 1 deselected / 3 selected @@ -188,7 +188,7 @@ Or to select "http" and "quick" tests: $ pytest -k "http or quick" -v =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collecting ... collected 4 items / 2 deselected / 2 selected @@ -228,9 +228,9 @@ You can ask which markers exist for your test suite - the list includes our just @pytest.mark.skip(reason=None): skip the given test function with an optional reason. Example: skip(reason="no way of currently testing this") skips the test. - @pytest.mark.skipif(condition): skip the given test function if eval(condition) results in a True value. Evaluation happens within the module global context. Example: skipif('sys.platform == "win32"') skips the test if we are on the win32 platform. see https://docs.pytest.org/en/stable/skipping.html + @pytest.mark.skipif(condition, ..., *, reason=...): skip the given test function if any of the conditions evaluate to True. Example: skipif(sys.platform == 'win32') skips the test if we are on the win32 platform. See https://docs.pytest.org/en/stable/reference.html#pytest-mark-skipif - @pytest.mark.xfail(condition, reason=None, run=True, raises=None, strict=False): mark the test function as an expected failure if eval(condition) has a True value. Optionally specify a reason for better reporting and run=False if you don't even want to execute the test function. If only specific exception(s) are expected, you can list them in raises, and if the test fails in other ways, it will be reported as a true failure. See https://docs.pytest.org/en/stable/skipping.html + @pytest.mark.xfail(condition, ..., *, reason=..., run=True, raises=None, strict=xfail_strict): mark the test function as an expected failure if any of the conditions evaluate to True. Optionally specify a reason for better reporting and run=False if you don't even want to execute the test function. If only specific exception(s) are expected, you can list them in raises, and if the test fails in other ways, it will be reported as a true failure. See https://docs.pytest.org/en/stable/reference.html#pytest-mark-xfail @pytest.mark.parametrize(argnames, argvalues): call a test function multiple times passing in different arguments in turn. argvalues generally needs to be a list of values if argnames specifies only one name or a list of tuples of values if argnames specifies multiple names. Example: @parametrize('arg1', [1,2]) would lead to two calls of the decorated test function, one with arg1=1 and another with arg1=2.see https://docs.pytest.org/en/stable/parametrize.html for more info and examples. @@ -398,7 +398,7 @@ the test needs: $ pytest -E stage2 =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 1 item @@ -413,7 +413,7 @@ and here is one that specifies exactly the environment needed: $ pytest -E stage1 =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 1 item @@ -433,9 +433,9 @@ The ``--markers`` option always gives you a list of available markers: @pytest.mark.skip(reason=None): skip the given test function with an optional reason. Example: skip(reason="no way of currently testing this") skips the test. - @pytest.mark.skipif(condition): skip the given test function if eval(condition) results in a True value. Evaluation happens within the module global context. Example: skipif('sys.platform == "win32"') skips the test if we are on the win32 platform. see https://docs.pytest.org/en/stable/skipping.html + @pytest.mark.skipif(condition, ..., *, reason=...): skip the given test function if any of the conditions evaluate to True. Example: skipif(sys.platform == 'win32') skips the test if we are on the win32 platform. See https://docs.pytest.org/en/stable/reference.html#pytest-mark-skipif - @pytest.mark.xfail(condition, reason=None, run=True, raises=None, strict=False): mark the test function as an expected failure if eval(condition) has a True value. Optionally specify a reason for better reporting and run=False if you don't even want to execute the test function. If only specific exception(s) are expected, you can list them in raises, and if the test fails in other ways, it will be reported as a true failure. See https://docs.pytest.org/en/stable/skipping.html + @pytest.mark.xfail(condition, ..., *, reason=..., run=True, raises=None, strict=xfail_strict): mark the test function as an expected failure if any of the conditions evaluate to True. Optionally specify a reason for better reporting and run=False if you don't even want to execute the test function. If only specific exception(s) are expected, you can list them in raises, and if the test fails in other ways, it will be reported as a true failure. See https://docs.pytest.org/en/stable/reference.html#pytest-mark-xfail @pytest.mark.parametrize(argnames, argvalues): call a test function multiple times passing in different arguments in turn. argvalues generally needs to be a list of values if argnames specifies only one name or a list of tuples of values if argnames specifies multiple names. Example: @parametrize('arg1', [1,2]) would lead to two calls of the decorated test function, one with arg1=1 and another with arg1=2.see https://docs.pytest.org/en/stable/parametrize.html for more info and examples. @@ -606,7 +606,7 @@ then you will see two tests skipped and two executed tests as expected: $ pytest -rs # this option reports skip reasons =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 4 items @@ -614,7 +614,7 @@ then you will see two tests skipped and two executed tests as expected: test_plat.py s.s. [100%] ========================= short test summary info ========================== - SKIPPED [2] $REGENDOC_TMPDIR/conftest.py:12: cannot run on platform linux + SKIPPED [2] conftest.py:12: cannot run on platform linux ======================= 2 passed, 2 skipped in 0.12s ======================= Note that if you specify a platform via the marker-command line option like this: @@ -623,7 +623,7 @@ Note that if you specify a platform via the marker-command line option like this $ pytest -m linux =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 4 items / 3 deselected / 1 selected @@ -687,7 +687,7 @@ We can now use the ``-m option`` to select one set: $ pytest -m interface --tb=short =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 4 items / 2 deselected / 2 selected @@ -714,7 +714,7 @@ or to select both "event" and "interface" tests: $ pytest -m "interface or event" --tb=short =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 4 items / 1 deselected / 3 selected diff --git a/doc/en/example/nonpython.rst b/doc/en/example/nonpython.rst index 083f6b439..d15b7ae8b 100644 --- a/doc/en/example/nonpython.rst +++ b/doc/en/example/nonpython.rst @@ -29,7 +29,7 @@ now execute the test specification: nonpython $ pytest test_simple.yaml =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR/nonpython collected 2 items @@ -66,7 +66,7 @@ consulted when reporting in ``verbose`` mode: nonpython $ pytest -v =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR/nonpython collecting ... collected 2 items @@ -92,11 +92,12 @@ interesting to just look at the collection tree: nonpython $ pytest --collect-only =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR/nonpython collected 2 items - + + diff --git a/doc/en/example/parametrize.rst b/doc/en/example/parametrize.rst index 0b61a19bc..8fa48bfe3 100644 --- a/doc/en/example/parametrize.rst +++ b/doc/en/example/parametrize.rst @@ -160,10 +160,11 @@ objects, they are still using the default pytest representation: $ pytest test_time.py --collect-only =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 8 items + @@ -224,7 +225,7 @@ this is a fully self-contained example which you can run with: $ pytest test_scenarios.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 4 items @@ -239,10 +240,11 @@ If you just collect tests you'll also nicely see 'advanced' and 'basic' as varia $ pytest --collect-only test_scenarios.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 4 items + @@ -317,10 +319,11 @@ Let's first see how it looks like at collection time: $ pytest test_backends.py --collect-only =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 2 items + @@ -415,15 +418,14 @@ The result of this test will be successful: $ pytest -v test_indirect_list.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR - collected 1 item + collecting ... collected 1 item - test_indirect_list.py::test_indirect[a-b] PASSED - - ========================== 1 passed in 0.01s =============================== + test_indirect_list.py::test_indirect[a-b] PASSED [100%] + ============================ 1 passed in 0.12s ============================= .. regendoc:wipe @@ -506,10 +508,11 @@ Running it results in some skips if we don't have all the python interpreters in .. code-block:: pytest . $ pytest -rs -q multipython.py - ssssssssssss......sss...... [100%] + ssssssssssssssssssssssss... [100%] ========================= short test summary info ========================== - SKIPPED [15] $REGENDOC_TMPDIR/CWD/multipython.py:29: 'python3.5' not found - 12 passed, 15 skipped in 0.12s + SKIPPED [12] multipython.py:29: 'python3.5' not found + SKIPPED [12] multipython.py:29: 'python3.6' not found + 3 passed, 24 skipped in 0.12s Indirect parametrization of optional implementations/imports -------------------------------------------------------------------- @@ -569,7 +572,7 @@ If you run this with reporting for skips enabled: $ pytest -rs test_module.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 2 items @@ -577,7 +580,7 @@ If you run this with reporting for skips enabled: test_module.py .s [100%] ========================= short test summary info ========================== - SKIPPED [1] $REGENDOC_TMPDIR/conftest.py:12: could not import 'opt2': No module named 'opt2' + SKIPPED [1] conftest.py:12: could not import 'opt2': No module named 'opt2' ======================= 1 passed, 1 skipped in 0.12s ======================= You'll see that we don't have an ``opt2`` module and thus the second test run @@ -631,7 +634,7 @@ Then run ``pytest`` with verbose mode and with only the ``basic`` marker: $ pytest -v -m basic =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collecting ... collected 14 items / 11 deselected / 3 selected diff --git a/doc/en/example/pythoncollection.rst b/doc/en/example/pythoncollection.rst index 30d106ada..85e5da263 100644 --- a/doc/en/example/pythoncollection.rst +++ b/doc/en/example/pythoncollection.rst @@ -147,10 +147,11 @@ The test collection would look like this: $ pytest --collect-only =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache - rootdir: $REGENDOC_TMPDIR, inifile: pytest.ini + rootdir: $REGENDOC_TMPDIR, configfile: pytest.ini collected 2 items + @@ -208,10 +209,11 @@ You can always peek at the collection tree without running tests like this: . $ pytest --collect-only pythoncollection.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache - rootdir: $REGENDOC_TMPDIR, inifile: pytest.ini + rootdir: $REGENDOC_TMPDIR, configfile: pytest.ini collected 3 items + @@ -289,9 +291,9 @@ file will be left out: $ pytest --collect-only =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache - rootdir: $REGENDOC_TMPDIR, inifile: pytest.ini + rootdir: $REGENDOC_TMPDIR, configfile: pytest.ini collected 0 items ========================== no tests ran in 0.12s =========================== diff --git a/doc/en/example/reportingdemo.rst b/doc/en/example/reportingdemo.rst index 23c302eca..f1b973f3b 100644 --- a/doc/en/example/reportingdemo.rst +++ b/doc/en/example/reportingdemo.rst @@ -9,7 +9,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: assertion $ pytest failure_demo.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR/assertion collected 44 items @@ -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:20: AssertionError + failure_demo.py:19: 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:31: AssertionError + failure_demo.py:30: 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:34: + failure_demo.py:33: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 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:15: AssertionError + failure_demo.py:14: 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:40: AssertionError + failure_demo.py:39: AssertionError _________________ TestSpecialisedExplanations.test_eq_text _________________ self = @@ -84,7 +84,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: E - eggs E + spam - failure_demo.py:45: AssertionError + failure_demo.py:44: 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 1 bar E ? ^ - failure_demo.py:48: AssertionError + failure_demo.py:47: 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 + spam E bar - failure_demo.py:51: AssertionError + failure_demo.py:50: 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 + 1111111111a222222222 E ? ^ - failure_demo.py:56: AssertionError + failure_demo.py:55: 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:61: AssertionError + failure_demo.py:60: 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:64: AssertionError + failure_demo.py:63: 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:69: AssertionError + failure_demo.py:68: 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:72: AssertionError + failure_demo.py:71: 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:75: AssertionError + failure_demo.py:74: 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 one more item: 3 E Use -v to get the full diff - failure_demo.py:78: AssertionError + failure_demo.py:77: 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:81: AssertionError + failure_demo.py:80: 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:85: AssertionError + failure_demo.py:84: 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:89: AssertionError + failure_demo.py:88: 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:93: AssertionError + failure_demo.py:92: 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:97: AssertionError + failure_demo.py:96: AssertionError ______________ TestSpecialisedExplanations.test_eq_dataclass _______________ self = @@ -302,11 +302,17 @@ Here is a nice run of several failures and how ``pytest`` presents things: right = Foo(1, "c") > assert left == right E AssertionError: assert TestSpecialis...oo(a=1, b='b') == TestSpecialis...oo(a=1, b='c') + E E Omitting 1 identical items, use -vv to show E Differing attributes: - E b: 'b' != 'c' + E ['b'] + E + E Drill down into differing attribute b: + E b: 'b' != 'c'... + E + E ...Full output truncated (3 lines hidden), use '-vv' to show - failure_demo.py:109: AssertionError + failure_demo.py:108: AssertionError ________________ TestSpecialisedExplanations.test_eq_attrs _________________ self = @@ -323,11 +329,17 @@ Here is a nice run of several failures and how ``pytest`` presents things: right = Foo(1, "c") > assert left == right E AssertionError: assert Foo(a=1, b='b') == Foo(a=1, b='c') + E E Omitting 1 identical items, use -vv to show E Differing attributes: - E b: 'b' != 'c' + E ['b'] + E + E Drill down into differing attribute b: + E b: 'b' != 'c'... + E + E ...Full output truncated (3 lines hidden), use '-vv' to show - failure_demo.py:121: AssertionError + failure_demo.py:120: AssertionError ______________________________ test_attribute ______________________________ def test_attribute(): @@ -339,7 +351,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:129: AssertionError + failure_demo.py:128: AssertionError _________________________ test_attribute_instance __________________________ def test_attribute_instance(): @@ -351,7 +363,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:136: AssertionError + failure_demo.py:135: AssertionError __________________________ test_attribute_failure __________________________ def test_attribute_failure(): @@ -364,7 +376,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: i = Foo() > assert i.b == 2 - failure_demo.py:147: + failure_demo.py:146: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = .Foo object at 0xdeadbeef> @@ -373,7 +385,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:142: Exception + failure_demo.py:141: Exception _________________________ test_attribute_multiple __________________________ def test_attribute_multiple(): @@ -390,7 +402,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:157: AssertionError + failure_demo.py:156: AssertionError __________________________ TestRaises.test_raises __________________________ self = @@ -400,7 +412,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:167: ValueError + failure_demo.py:166: ValueError ______________________ TestRaises.test_raises_doesnt _______________________ self = @@ -409,7 +421,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: > raises(OSError, int, "3") E Failed: DID NOT RAISE - failure_demo.py:170: Failed + failure_demo.py:169: Failed __________________________ TestRaises.test_raise ___________________________ self = @@ -418,7 +430,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:173: ValueError + failure_demo.py:172: ValueError ________________________ TestRaises.test_tupleerror ________________________ self = @@ -427,7 +439,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:176: ValueError + failure_demo.py:175: ValueError ______ TestRaises.test_reinterpret_fails_with_print_for_the_fun_of_it ______ self = @@ -438,7 +450,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: > a, b = items.pop() E TypeError: cannot unpack non-iterable int object - failure_demo.py:181: TypeError + failure_demo.py:180: TypeError --------------------------- Captured stdout call --------------------------- items is [1, 2, 3] ________________________ TestRaises.test_some_error ________________________ @@ -449,7 +461,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:184: NameError + failure_demo.py:183: NameError ____________________ test_dynamic_compile_shows_nicely _____________________ def test_dynamic_compile_shows_nicely(): @@ -460,19 +472,18 @@ Here is a nice run of several failures and how ``pytest`` presents things: name = "abc-123" spec = importlib.util.spec_from_loader(name, loader=None) module = importlib.util.module_from_spec(spec) - code = _pytest._code.compile(src, name, "exec") + code = compile(src, name, "exec") exec(code, module.__dict__) sys.modules[name] = module > module.foo() - failure_demo.py:203: + failure_demo.py:202: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ - def foo(): - > assert 1 == 0 - E AssertionError + > ??? + E AssertionError - <0-codegen 'abc-123' $REGENDOC_TMPDIR/assertion/failure_demo.py:200>:2: AssertionError + abc-123:2: AssertionError ____________________ TestMoreErrors.test_complex_error _____________________ self = @@ -486,9 +497,9 @@ Here is a nice run of several failures and how ``pytest`` presents things: > somefunc(f(), g()) - failure_demo.py:214: + failure_demo.py:213: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ - failure_demo.py:11: in somefunc + failure_demo.py:10: in somefunc otherfunc(x, y) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ @@ -498,7 +509,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: > assert a == b E assert 44 == 43 - failure_demo.py:7: AssertionError + failure_demo.py:6: AssertionError ___________________ TestMoreErrors.test_z1_unpack_error ____________________ self = @@ -508,7 +519,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:218: ValueError + failure_demo.py:217: ValueError ____________________ TestMoreErrors.test_z2_type_error _____________________ self = @@ -518,7 +529,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: > a, b = items E TypeError: cannot unpack non-iterable int object - failure_demo.py:222: TypeError + failure_demo.py:221: TypeError ______________________ TestMoreErrors.test_startswith ______________________ self = @@ -531,7 +542,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:227: AssertionError + failure_demo.py:226: AssertionError __________________ TestMoreErrors.test_startswith_nested ___________________ self = @@ -550,7 +561,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:236: AssertionError + failure_demo.py:235: AssertionError _____________________ TestMoreErrors.test_global_func ______________________ self = @@ -561,7 +572,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:239: AssertionError + failure_demo.py:238: AssertionError _______________________ TestMoreErrors.test_instance _______________________ self = @@ -572,7 +583,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:243: AssertionError + failure_demo.py:242: AssertionError _______________________ TestMoreErrors.test_compare ________________________ self = @@ -582,7 +593,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:246: AssertionError + failure_demo.py:245: AssertionError _____________________ TestMoreErrors.test_try_finally ______________________ self = @@ -593,7 +604,7 @@ Here is a nice run of several failures and how ``pytest`` presents things: > assert x == 0 E assert 1 == 0 - failure_demo.py:251: AssertionError + failure_demo.py:250: AssertionError ___________________ TestCustomAssertMsg.test_single_line ___________________ self = @@ -608,7 +619,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:262: AssertionError + failure_demo.py:261: AssertionError ____________________ TestCustomAssertMsg.test_multiline ____________________ self = @@ -627,7 +638,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:269: AssertionError + failure_demo.py:268: AssertionError ___________________ TestCustomAssertMsg.test_custom_repr ___________________ self = @@ -649,7 +660,7 @@ 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:282: AssertionError + failure_demo.py:281: AssertionError ========================= short test summary info ========================== FAILED failure_demo.py::test_generative[3-6] - assert (3 * 2) < 6 FAILED failure_demo.py::TestFailing::test_simple - assert 42 == 43 diff --git a/doc/en/example/simple.rst b/doc/en/example/simple.rst index d1a1ecdfc..e9952dad4 100644 --- a/doc/en/example/simple.rst +++ b/doc/en/example/simple.rst @@ -175,7 +175,7 @@ directory with the above conftest.py: $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 0 items @@ -240,7 +240,7 @@ and when running it will see a skipped "slow" test: $ pytest -rs # "-rs" means report details on the little 's' =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 2 items @@ -257,7 +257,7 @@ Or run it including the ``slow`` marked test: $ pytest --runslow =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 2 items @@ -401,7 +401,7 @@ which will add the string to the test header accordingly: $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache project deps: mylib-1.1 rootdir: $REGENDOC_TMPDIR @@ -430,7 +430,7 @@ which will add info only when run with "--v": $ pytest -v =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache info1: did you know that ... did you? @@ -445,7 +445,7 @@ and nothing when run plainly: $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 0 items @@ -485,14 +485,14 @@ Now we can profile which test functions execute the slowest: $ pytest --durations=3 =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 3 items test_some_are_slow.py ... [100%] - ========================= slowest 3 test durations ========================= + =========================== slowest 3 durations ============================ 0.30s call test_some_are_slow.py::test_funcslow2 0.20s call test_some_are_slow.py::test_funcslow1 0.10s call test_some_are_slow.py::test_funcfast @@ -591,7 +591,7 @@ If we run this: $ pytest -rx =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 4 items @@ -675,7 +675,7 @@ We can run this: $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 7 items @@ -794,7 +794,7 @@ and run them: $ pytest test_module.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 2 items @@ -901,7 +901,7 @@ and run it: $ pytest -s test_module.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 3 items diff --git a/doc/en/fixture.rst b/doc/en/fixture.rst index a4e262c2f..8d2d06367 100644 --- a/doc/en/fixture.rst +++ b/doc/en/fixture.rst @@ -151,7 +151,7 @@ marked ``smtp_connection`` fixture function. Running the test looks like this: $ pytest test_smtpsimple.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 1 item @@ -303,7 +303,7 @@ inspect what is going on and can now run the tests: $ pytest test_module.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 2 items @@ -906,10 +906,11 @@ Running the above tests results in the following test IDs being used: $ pytest --collect-only =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 10 items + @@ -956,7 +957,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-5.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collecting ... collected 3 items @@ -1006,7 +1007,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-5.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collecting ... collected 2 items @@ -1086,7 +1087,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-5.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y -- $PYTHON_PREFIX/bin/python cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collecting ... collected 8 items diff --git a/doc/en/getting-started.rst b/doc/en/getting-started.rst index bcfd49ae2..0424faa88 100644 --- a/doc/en/getting-started.rst +++ b/doc/en/getting-started.rst @@ -28,7 +28,7 @@ Install ``pytest`` .. code-block:: bash $ pytest --version - This is pytest version 5.x.y, imported from $PYTHON_PREFIX/lib/python3.8/site-packages/pytest/__init__.py + pytest 6.0.0rc1 .. _`simpletest`: @@ -53,7 +53,7 @@ That’s it. You can now execute the test function: $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 1 item @@ -181,33 +181,30 @@ This is outlined below: .. code-block:: pytest $ pytest -k TestClassDemoInstance -q + FF [100%] + ================================= FAILURES ================================= + ______________________ TestClassDemoInstance.test_one ______________________ - FF [100%] - ================================== FAILURES =================================== - _______________________ TestClassDemoInstance.test_one ________________________ + self = - self = - request = > - - def test_one(self, request): + def test_one(self): > assert 0 E assert 0 - testing\test_example.py:4: AssertionError - _______________________ TestClassDemoInstance.test_two ________________________ + test_class_demo.py:3: AssertionError + ______________________ TestClassDemoInstance.test_two ______________________ - self = - request = > + self = - def test_two(self, request): + def test_two(self): > assert 0 E assert 0 - testing\test_example.py:7: AssertionError - =========================== short test summary info =========================== - FAILED testing/test_example.py::TestClassDemoInstance::test_one - assert 0 - FAILED testing/test_example.py::TestClassDemoInstance::test_two - assert 0 - 2 failed in 0.11s + test_class_demo.py:6: AssertionError + ========================= short test summary info ========================== + FAILED test_class_demo.py::TestClassDemoInstance::test_one - assert 0 + FAILED test_class_demo.py::TestClassDemoInstance::test_two - assert 0 + 2 failed in 0.12s Request a unique temporary directory for functional tests -------------------------------------------------------------- diff --git a/doc/en/index.rst b/doc/en/index.rst index 04c2a36e0..f1cb533d7 100644 --- a/doc/en/index.rst +++ b/doc/en/index.rst @@ -28,7 +28,7 @@ To execute it: $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 1 item diff --git a/doc/en/parametrize.rst b/doc/en/parametrize.rst index 1e356ebb3..c8b0bf4f3 100644 --- a/doc/en/parametrize.rst +++ b/doc/en/parametrize.rst @@ -56,7 +56,7 @@ them in turn: $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 3 items @@ -123,7 +123,7 @@ Let's run this: $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 3 items diff --git a/doc/en/skipping.rst b/doc/en/skipping.rst index 1a85ecf07..951a56566 100644 --- a/doc/en/skipping.rst +++ b/doc/en/skipping.rst @@ -373,7 +373,7 @@ Running it with the report-on-xfail option gives this output: example $ pytest -rx xfail_demo.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR/example collected 7 items diff --git a/doc/en/tmpdir.rst b/doc/en/tmpdir.rst index a4f7326fd..a3749d855 100644 --- a/doc/en/tmpdir.rst +++ b/doc/en/tmpdir.rst @@ -41,7 +41,7 @@ Running this would result in a passed test except for the last $ pytest test_tmp_path.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 1 item @@ -114,7 +114,7 @@ Running this would result in a passed test except for the last $ pytest test_tmpdir.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 1 item diff --git a/doc/en/unittest.rst b/doc/en/unittest.rst index c30b17110..130e7705b 100644 --- a/doc/en/unittest.rst +++ b/doc/en/unittest.rst @@ -137,7 +137,7 @@ the ``self.db`` values in the traceback: $ pytest test_unittest_db.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 2 items diff --git a/doc/en/usage.rst b/doc/en/usage.rst index e25793f87..aafdeb55f 100644 --- a/doc/en/usage.rst +++ b/doc/en/usage.rst @@ -216,7 +216,7 @@ Example: $ pytest -ra =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 6 items @@ -241,7 +241,7 @@ Example: test_example.py:14: AssertionError ========================= short test summary info ========================== - SKIPPED [1] $REGENDOC_TMPDIR/test_example.py:22: skipping this test + SKIPPED [1] test_example.py:22: skipping this test XFAIL test_example.py::test_xfail reason: xfailing this test XPASS test_example.py::test_xpass always xfail @@ -274,7 +274,7 @@ More than one character can be used, so for example to only see failed and skipp $ pytest -rfs =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 6 items @@ -300,7 +300,7 @@ More than one character can be used, so for example to only see failed and skipp test_example.py:14: AssertionError ========================= short test summary info ========================== FAILED test_example.py::test_fail - assert 0 - SKIPPED [1] $REGENDOC_TMPDIR/test_example.py:22: skipping this test + SKIPPED [1] test_example.py:22: skipping this test == 1 failed, 1 passed, 1 skipped, 1 xfailed, 1 xpassed, 1 error in 0.12s === Using ``p`` lists the passing tests, whilst ``P`` adds an extra section "PASSES" with those tests that passed but had @@ -310,7 +310,7 @@ captured output: $ pytest -rpP =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 6 items diff --git a/doc/en/warnings.rst b/doc/en/warnings.rst index 0b47009d6..6a37b2ad0 100644 --- a/doc/en/warnings.rst +++ b/doc/en/warnings.rst @@ -28,7 +28,7 @@ Running pytest now produces this output: $ pytest test_show_warnings.py =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache rootdir: $REGENDOC_TMPDIR collected 1 item diff --git a/doc/en/writing_plugins.rst b/doc/en/writing_plugins.rst index 27d0fb57c..f3e4cbd23 100644 --- a/doc/en/writing_plugins.rst +++ b/doc/en/writing_plugins.rst @@ -430,9 +430,9 @@ additionally it is possible to copy examples for an example folder before runnin $ pytest =========================== test session starts ============================ - platform linux -- Python 3.x.y, pytest-5.x.y, py-1.x.y, pluggy-0.x.y + platform linux -- Python 3.x.y, pytest-6.x.y, py-1.x.y, pluggy-0.x.y cachedir: $PYTHON_PREFIX/.pytest_cache - rootdir: $REGENDOC_TMPDIR, inifile: pytest.ini + rootdir: $REGENDOC_TMPDIR, configfile: pytest.ini collected 2 items test_example.py .. [100%] @@ -443,7 +443,7 @@ additionally it is possible to copy examples for an example folder before runnin testdir.copy_example("test_example.py") test_example.py::test_plugin - $PYTHON_PREFIX/lib/python3.8/site-packages/_pytest/compat.py:333: PytestDeprecationWarning: The TerminalReporter.writer attribute is deprecated, use TerminalReporter._tw instead at your own risk. + $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)