Prepare release version 6.0.0rc1
This commit is contained in:
parent
64b19595a5
commit
7d033a8950
|
@ -1 +0,0 @@
|
|||
Fix issue where directories from tmpdir are not removed properly when multiple instances of pytest are running in parallel.
|
|
@ -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)``.
|
|
@ -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 <https://docs.pytest.org/en/stable/customize.html#configuration-file-formats>`__.
|
|
@ -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.
|
|
@ -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.
|
|
@ -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``).
|
|
@ -1 +0,0 @@
|
|||
Improved precision of test durations measurement. ``CallInfo`` items now have a new ``<CallInfo>.duration`` attribute, created using ``time.perf_counter()``. This attribute is used to fill the ``<TestReport>.duration`` attribute, which is more accurate than the previous ``<CallInfo>.stop - <CallInfo>.start`` (as these are based on ``time.time()``).
|
|
@ -1 +0,0 @@
|
|||
Prevent crashing and provide a user-friendly error when a marker expression (-m) invoking of eval() raises any exception.
|
|
@ -1 +0,0 @@
|
|||
Rich comparison for dataclasses and `attrs`-classes is now recursive.
|
|
@ -1 +0,0 @@
|
|||
The path shown in the summary report for SKIPPED tests is now always relative. Previously it was sometimes absolute.
|
|
@ -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``.
|
|
@ -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 <https://github.com/pytest-dev/pytest/pull/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.
|
|
@ -1,2 +0,0 @@
|
|||
Fixes an issue where logging during collection step caused duplication of log
|
||||
messages to stderr.
|
|
@ -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.
|
|
@ -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.
|
|
@ -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``.
|
|
@ -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.
|
|
@ -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)
|
|
@ -1 +0,0 @@
|
|||
Support deleting paths longer than 260 characters on windows created inside tmpdir.
|
|
@ -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.
|
|
@ -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.
|
|
@ -1 +0,0 @@
|
|||
Fix crash with captured output when using the :fixture:`capsysbinary fixture <capsysbinary>`.
|
|
@ -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.
|
|
@ -1 +0,0 @@
|
|||
Added `--code-highlight` command line option to enable/disable code highlighting in terminal output.
|
|
@ -1,3 +0,0 @@
|
|||
Revert the change introduced by `#6330 <https://github.com/pytest-dev/pytest/pull/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.
|
|
@ -1 +0,0 @@
|
|||
Fix crash when plugins return an unknown stats while using the ``--reportlog`` option.
|
|
@ -1 +0,0 @@
|
|||
Ensure a ``unittest.IsolatedAsyncioTestCase`` is actually awaited.
|
|
@ -1 +0,0 @@
|
|||
Fix TerminalRepr instances to be hashable again.
|
|
@ -1 +0,0 @@
|
|||
When using the ``--duration`` option, the terminal message output is now more precise about the number and durations of hidden items.
|
|
@ -1 +0,0 @@
|
|||
Fix regression where functions registered with ``TestCase.addCleanup`` were not being called on test failures.
|
|
@ -1 +0,0 @@
|
|||
Allow users to still set the deprecated ``TerminalReporter.writer`` attribute.
|
|
@ -1 +0,0 @@
|
|||
Prevent pytest from printing ConftestImportFailure traceback to stdout.
|
|
@ -1 +0,0 @@
|
|||
Deprecate the ``pytest.collect`` module as it's just aliases into ``pytest``.
|
|
@ -1 +0,0 @@
|
|||
Fix regressions with `--lf` filtering too much since pytest 5.4.
|
|
@ -1 +0,0 @@
|
|||
Collected files are displayed after any reports from hooks, e.g. the status from ``--lf``.
|
|
@ -1 +0,0 @@
|
|||
Revert "tmpdir: clean up indirection via config for factories" #6767 as it breaks pytest-xdist.
|
|
@ -1,2 +0,0 @@
|
|||
The ``originalname`` attribute of ``_pytest.python.Function`` now defaults to ``name`` if not
|
||||
provided explicitly, and is always set.
|
|
@ -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.
|
|
@ -1 +0,0 @@
|
|||
When a yielding fixture fails to yield a value, report a test setup error instead of crashing.
|
|
@ -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.
|
|
@ -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.
|
|
@ -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.
|
|
@ -1 +0,0 @@
|
|||
Fixed regression: ``asyncbase.TestCase`` tests are executed correctly again.
|
|
@ -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.
|
|
@ -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.
|
|
@ -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.
|
|
@ -1 +0,0 @@
|
|||
`pytest --version` now displays just the pytest version, while `pytest --version --version` displays more verbose information including plugins.
|
|
@ -1 +0,0 @@
|
|||
``caplog.set_level()`` will now override any :confval:`log_level` set via the CLI or ``.ini``.
|
|
@ -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.
|
|
@ -1 +0,0 @@
|
|||
Fix ``File.from_constructor`` so it forwards extra keyword arguments to the constructor.
|
|
@ -1 +0,0 @@
|
|||
Classes with broken ``__getattribute__`` methods are displayed correctly during failures.
|
|
@ -1 +0,0 @@
|
|||
Prevent hiding the underlying exception when ``ConfTestImportFailure`` is raised.
|
|
@ -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.
|
|
@ -1 +0,0 @@
|
|||
Fix ``_is_setup_py`` for files encoded differently than locale.
|
|
@ -1 +0,0 @@
|
|||
The development guide now links to the contributing section of the docs and 'RELEASING.rst' on GitHub.
|
|
@ -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.
|
|
@ -1,2 +0,0 @@
|
|||
Fix regression where running with ``--pdb`` would call the ``tearDown`` methods of ``unittest.TestCase``
|
||||
subclasses for skipped tests.
|
|
@ -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.
|
|
@ -1 +0,0 @@
|
|||
Removed the unused ``args`` parameter from ``pytest.Function.__init__``.
|
|
@ -1 +0,0 @@
|
|||
Add a note about ``--strict`` and ``--strict-markers`` and the preference for the latter one.
|
|
@ -1,14 +0,0 @@
|
|||
New ``--import-mode=importlib`` option that uses `importlib <https://docs.python.org/3/library/importlib.html>`__ 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 <https://github.com/pytest-dev/pytest/issues/7245>`__.
|
||||
|
||||
You can read more about this option in `the documentation <https://docs.pytest.org/en/latest/pythonpath.html#import-modes>`__.
|
|
@ -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.
|
|
@ -1 +0,0 @@
|
|||
The dependency on the ``wcwidth`` package has been removed.
|
|
@ -1 +0,0 @@
|
|||
Replaced ``py.iniconfig`` with `iniconfig <https://pypi.org/project/iniconfig/>`__.
|
|
@ -1 +0,0 @@
|
|||
``src/_pytest/config/__init__.py`` now uses the ``warnings`` module to report warnings instead of ``sys.stderr.write``.
|
|
@ -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.
|
|
@ -1 +0,0 @@
|
|||
Explain indirect parametrization and markers for fixtures
|
|
@ -1 +0,0 @@
|
|||
Version information as defined by `PEP 440 <https://www.python.org/dev/peps/pep-0440/#version-specifiers>`_ may now be included when providing plugins to the ``required_plugins`` configuration option.
|
|
@ -1 +0,0 @@
|
|||
Improve recursive diff report for comparison asserts on dataclasses / attrs.
|
|
@ -1 +0,0 @@
|
|||
Remove last internal uses of deprecated "slave" term from old pytest-xdist.
|
|
@ -1 +0,0 @@
|
|||
py>=1.8.2 is now required.
|
|
@ -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.
|
|
@ -1 +0,0 @@
|
|||
Fixed exception causes all over the codebase, i.e. use `raise new_exception from old_exception` when wrapping an exception.
|
|
@ -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
|
||||
|
||||
<error message="test setup failure">
|
||||
|
||||
Now:
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<error message="failed on setup with "ValueError: Some error during setup"">
|
|
@ -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.
|
|
@ -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.
|
|
@ -6,6 +6,7 @@ Release announcements
|
|||
:maxdepth: 2
|
||||
|
||||
|
||||
release-6.0.0rc1
|
||||
release-5.4.3
|
||||
release-5.4.2
|
||||
release-5.4.1
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 <https://github.com/pytest-dev/pytest/issues/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 <https://github.com/pytest-dev/pytest/issues/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 <https://github.com/pytest-dev/pytest/pull/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 <https://github.com/pytest-dev/pytest/issues/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 <https://github.com/pytest-dev/pytest/issues/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 <https://github.com/pytest-dev/pytest/issues/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 <https://github.com/pytest-dev/pytest/issues/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 <https://github.com/pytest-dev/pytest/issues/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 <https://github.com/pytest-dev/pytest/issues/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 <https://github.com/pytest-dev/pytest/issues/7226>`_: Removed the unused ``args`` parameter from ``pytest.Function.__init__``.
|
||||
|
||||
|
||||
- `#7418 <https://github.com/pytest-dev/pytest/issues/7418>`_: Remove the `pytest_doctest_prepare_content` hook specification. This hook
|
||||
hasn't been triggered by pytest for at least 10 years.
|
||||
|
||||
|
||||
- `#7438 <https://github.com/pytest-dev/pytest/issues/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 <https://github.com/pytest-dev/pytest/issues/6981>`_: Deprecate the ``pytest.collect`` module as it's just aliases into ``pytest``.
|
||||
|
||||
|
||||
- `#7097 <https://github.com/pytest-dev/pytest/issues/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 <https://github.com/pytest-dev/pytest/issues/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 <https://github.com/pytest-dev/pytest/issues/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 <https://docs.pytest.org/en/stable/customize.html#configuration-file-formats>`__.
|
||||
|
||||
|
||||
- `#3342 <https://github.com/pytest-dev/pytest/issues/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 <https://github.com/pytest-dev/pytest/issues/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 <https://github.com/pytest-dev/pytest/issues/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 <https://github.com/pytest-dev/pytest/issues/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 <https://github.com/pytest-dev/pytest/issues/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 <https://github.com/pytest-dev/pytest/issues/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 <https://github.com/pytest-dev/pytest/issues/6906>`_: Added `--code-highlight` command line option to enable/disable code highlighting in terminal output.
|
||||
|
||||
|
||||
- `#7245 <https://github.com/pytest-dev/pytest/issues/7245>`_: New ``--import-mode=importlib`` option that uses `importlib <https://docs.python.org/3/library/importlib.html>`__ 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 <https://github.com/pytest-dev/pytest/issues/7245>`__.
|
||||
|
||||
You can read more about this option in `the documentation <https://docs.pytest.org/en/latest/pythonpath.html#import-modes>`__.
|
||||
|
||||
|
||||
- `#7305 <https://github.com/pytest-dev/pytest/issues/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 <https://github.com/pytest-dev/pytest/issues/7346>`_: Version information as defined by `PEP 440 <https://www.python.org/dev/peps/pep-0440/#version-specifiers>`_ may now be included when providing plugins to the ``required_plugins`` configuration option.
|
||||
|
||||
|
||||
|
||||
Improvements
|
||||
------------
|
||||
|
||||
- `#4375 <https://github.com/pytest-dev/pytest/issues/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 <https://github.com/pytest-dev/pytest/issues/4391>`_: Improved precision of test durations measurement. ``CallInfo`` items now have a new ``<CallInfo>.duration`` attribute, created using ``time.perf_counter()``. This attribute is used to fill the ``<TestReport>.duration`` attribute, which is more accurate than the previous ``<CallInfo>.stop - <CallInfo>.start`` (as these are based on ``time.time()``).
|
||||
|
||||
|
||||
- `#4675 <https://github.com/pytest-dev/pytest/issues/4675>`_: Rich comparison for dataclasses and `attrs`-classes is now recursive.
|
||||
|
||||
|
||||
- `#6817 <https://github.com/pytest-dev/pytest/issues/6817>`_: Explicit new-lines in help texts of command-line options are preserved, allowing plugins better control
|
||||
of the help displayed to users.
|
||||
|
||||
|
||||
- `#6940 <https://github.com/pytest-dev/pytest/issues/6940>`_: When using the ``--duration`` option, the terminal message output is now more precise about the number and durations of hidden items.
|
||||
|
||||
|
||||
- `#6991 <https://github.com/pytest-dev/pytest/issues/6991>`_: Collected files are displayed after any reports from hooks, e.g. the status from ``--lf``.
|
||||
|
||||
|
||||
- `#7091 <https://github.com/pytest-dev/pytest/issues/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 <https://github.com/pytest-dev/pytest/issues/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 <https://github.com/pytest-dev/pytest/issues/7128>`_: `pytest --version` now displays just the pytest version, while `pytest --version --version` displays more verbose information including plugins.
|
||||
|
||||
|
||||
- `#7133 <https://github.com/pytest-dev/pytest/issues/7133>`_: ``caplog.set_level()`` will now override any :confval:`log_level` set via the CLI or ``.ini``.
|
||||
|
||||
|
||||
- `#7159 <https://github.com/pytest-dev/pytest/issues/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 <https://github.com/pytest-dev/pytest/issues/7264>`_: The dependency on the ``wcwidth`` package has been removed.
|
||||
|
||||
|
||||
- `#7348 <https://github.com/pytest-dev/pytest/issues/7348>`_: Improve recursive diff report for comparison asserts on dataclasses / attrs.
|
||||
|
||||
|
||||
- `#7385 <https://github.com/pytest-dev/pytest/issues/7385>`_: ``--junitxml`` now includes the exception cause in the ``message`` XML attribute for failures during setup and teardown.
|
||||
|
||||
Previously:
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<error message="test setup failure">
|
||||
|
||||
Now:
|
||||
|
||||
.. code-block:: xml
|
||||
|
||||
<error message="failed on setup with "ValueError: Some error during setup"">
|
||||
|
||||
|
||||
|
||||
Bug Fixes
|
||||
---------
|
||||
|
||||
- `#1120 <https://github.com/pytest-dev/pytest/issues/1120>`_: Fix issue where directories from tmpdir are not removed properly when multiple instances of pytest are running in parallel.
|
||||
|
||||
|
||||
- `#4583 <https://github.com/pytest-dev/pytest/issues/4583>`_: Prevent crashing and provide a user-friendly error when a marker expression (-m) invoking of eval() raises any exception.
|
||||
|
||||
|
||||
- `#4677 <https://github.com/pytest-dev/pytest/issues/4677>`_: The path shown in the summary report for SKIPPED tests is now always relative. Previously it was sometimes absolute.
|
||||
|
||||
|
||||
- `#5456 <https://github.com/pytest-dev/pytest/issues/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 <https://github.com/pytest-dev/pytest/issues/6240>`_: Fixes an issue where logging during collection step caused duplication of log
|
||||
messages to stderr.
|
||||
|
||||
|
||||
- `#6428 <https://github.com/pytest-dev/pytest/issues/6428>`_: Paths appearing in error messages are now correct in case the current working directory has
|
||||
changed since the start of the session.
|
||||
|
||||
|
||||
- `#6755 <https://github.com/pytest-dev/pytest/issues/6755>`_: Support deleting paths longer than 260 characters on windows created inside tmpdir.
|
||||
|
||||
|
||||
- `#6871 <https://github.com/pytest-dev/pytest/issues/6871>`_: Fix crash with captured output when using the :fixture:`capsysbinary fixture <capsysbinary>`.
|
||||
|
||||
|
||||
- `#6909 <https://github.com/pytest-dev/pytest/issues/6909>`_: Revert the change introduced by `#6330 <https://github.com/pytest-dev/pytest/pull/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 <https://github.com/pytest-dev/pytest/issues/6910>`_: Fix crash when plugins return an unknown stats while using the ``--reportlog`` option.
|
||||
|
||||
|
||||
- `#6924 <https://github.com/pytest-dev/pytest/issues/6924>`_: Ensure a ``unittest.IsolatedAsyncioTestCase`` is actually awaited.
|
||||
|
||||
|
||||
- `#6925 <https://github.com/pytest-dev/pytest/issues/6925>`_: Fix TerminalRepr instances to be hashable again.
|
||||
|
||||
|
||||
- `#6947 <https://github.com/pytest-dev/pytest/issues/6947>`_: Fix regression where functions registered with ``TestCase.addCleanup`` were not being called on test failures.
|
||||
|
||||
|
||||
- `#6951 <https://github.com/pytest-dev/pytest/issues/6951>`_: Allow users to still set the deprecated ``TerminalReporter.writer`` attribute.
|
||||
|
||||
|
||||
- `#6956 <https://github.com/pytest-dev/pytest/issues/6956>`_: Prevent pytest from printing ConftestImportFailure traceback to stdout.
|
||||
|
||||
|
||||
- `#6991 <https://github.com/pytest-dev/pytest/issues/6991>`_: Fix regressions with `--lf` filtering too much since pytest 5.4.
|
||||
|
||||
|
||||
- `#6992 <https://github.com/pytest-dev/pytest/issues/6992>`_: Revert "tmpdir: clean up indirection via config for factories" #6767 as it breaks pytest-xdist.
|
||||
|
||||
|
||||
- `#7061 <https://github.com/pytest-dev/pytest/issues/7061>`_: When a yielding fixture fails to yield a value, report a test setup error instead of crashing.
|
||||
|
||||
|
||||
- `#7076 <https://github.com/pytest-dev/pytest/issues/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 <https://github.com/pytest-dev/pytest/issues/7110>`_: Fixed regression: ``asyncbase.TestCase`` tests are executed correctly again.
|
||||
|
||||
|
||||
- `#7126 <https://github.com/pytest-dev/pytest/issues/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 <https://github.com/pytest-dev/pytest/issues/7143>`_: Fix ``File.from_constructor`` so it forwards extra keyword arguments to the constructor.
|
||||
|
||||
|
||||
- `#7145 <https://github.com/pytest-dev/pytest/issues/7145>`_: Classes with broken ``__getattribute__`` methods are displayed correctly during failures.
|
||||
|
||||
|
||||
- `#7150 <https://github.com/pytest-dev/pytest/issues/7150>`_: Prevent hiding the underlying exception when ``ConfTestImportFailure`` is raised.
|
||||
|
||||
|
||||
- `#7180 <https://github.com/pytest-dev/pytest/issues/7180>`_: Fix ``_is_setup_py`` for files encoded differently than locale.
|
||||
|
||||
|
||||
- `#7215 <https://github.com/pytest-dev/pytest/issues/7215>`_: Fix regression where running with ``--pdb`` would call the ``tearDown`` methods of ``unittest.TestCase``
|
||||
subclasses for skipped tests.
|
||||
|
||||
|
||||
- `#7253 <https://github.com/pytest-dev/pytest/issues/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 <https://github.com/pytest-dev/pytest/issues/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 <https://github.com/pytest-dev/pytest/issues/7383>`_: Fixed exception causes all over the codebase, i.e. use `raise new_exception from old_exception` when wrapping an exception.
|
||||
|
||||
|
||||
|
||||
Improved Documentation
|
||||
----------------------
|
||||
|
||||
- `#7202 <https://github.com/pytest-dev/pytest/issues/7202>`_: The development guide now links to the contributing section of the docs and 'RELEASING.rst' on GitHub.
|
||||
|
||||
|
||||
- `#7233 <https://github.com/pytest-dev/pytest/issues/7233>`_: Add a note about ``--strict`` and ``--strict-markers`` and the preference for the latter one.
|
||||
|
||||
|
||||
- `#7345 <https://github.com/pytest-dev/pytest/issues/7345>`_: Explain indirect parametrization and markers for fixtures
|
||||
|
||||
|
||||
|
||||
Trivial/Internal Changes
|
||||
------------------------
|
||||
|
||||
- `#7035 <https://github.com/pytest-dev/pytest/issues/7035>`_: The ``originalname`` attribute of ``_pytest.python.Function`` now defaults to ``name`` if not
|
||||
provided explicitly, and is always set.
|
||||
|
||||
|
||||
- `#7291 <https://github.com/pytest-dev/pytest/issues/7291>`_: Replaced ``py.iniconfig`` with `iniconfig <https://pypi.org/project/iniconfig/>`__.
|
||||
|
||||
|
||||
- `#7295 <https://github.com/pytest-dev/pytest/issues/7295>`_: ``src/_pytest/config/__init__.py`` now uses the ``warnings`` module to report warnings instead of ``sys.stderr.write``.
|
||||
|
||||
|
||||
- `#7356 <https://github.com/pytest-dev/pytest/issues/7356>`_: Remove last internal uses of deprecated "slave" term from old pytest-xdist.
|
||||
|
||||
|
||||
- `#7357 <https://github.com/pytest-dev/pytest/issues/7357>`_: py>=1.8.2 is now required.
|
||||
|
||||
|
||||
pytest 5.4.3 (2020-06-02)
|
||||
=========================
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
<Package $REGENDOC_TMPDIR/nonpython>
|
||||
|
||||
<Package nonpython>
|
||||
<YamlFile test_simple.yaml>
|
||||
<YamlItem hello>
|
||||
<YamlItem ok>
|
||||
|
|
|
@ -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
|
||||
|
||||
<Module test_time.py>
|
||||
<Function test_timedistance_v0[a0-b0-expected0]>
|
||||
<Function test_timedistance_v0[a1-b1-expected1]>
|
||||
|
@ -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
|
||||
|
||||
<Module test_scenarios.py>
|
||||
<Class TestSampleWithScenarios>
|
||||
<Function test_demo1[basic]>
|
||||
|
@ -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
|
||||
|
||||
<Module test_backends.py>
|
||||
<Function test_db_initialized[d1]>
|
||||
<Function test_db_initialized[d2]>
|
||||
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
<Module check_myapp.py>
|
||||
<Class CheckMyApp>
|
||||
<Function simple_check>
|
||||
|
@ -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
|
||||
|
||||
<Module CWD/pythoncollection.py>
|
||||
<Function test_function>
|
||||
<Class TestClass>
|
||||
|
@ -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 ===========================
|
||||
|
|
|
@ -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 = <failure_demo.TestFailing object at 0xdeadbeef>
|
||||
|
@ -43,7 +43,7 @@ Here is a nice run of several failures and how ``pytest`` presents things:
|
|||
E + where 42 = <function TestFailing.test_simple.<locals>.f at 0xdeadbeef>()
|
||||
E + and 43 = <function TestFailing.test_simple.<locals>.g at 0xdeadbeef>()
|
||||
|
||||
failure_demo.py:31: AssertionError
|
||||
failure_demo.py:30: AssertionError
|
||||
____________________ TestFailing.test_simple_multiline _____________________
|
||||
|
||||
self = <failure_demo.TestFailing object at 0xdeadbeef>
|
||||
|
@ -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 = <failure_demo.TestFailing object at 0xdeadbeef>
|
||||
|
@ -73,7 +73,7 @@ Here is a nice run of several failures and how ``pytest`` presents things:
|
|||
E assert not 42
|
||||
E + where 42 = <function TestFailing.test_not.<locals>.f at 0xdeadbeef>()
|
||||
|
||||
failure_demo.py:40: AssertionError
|
||||
failure_demo.py:39: AssertionError
|
||||
_________________ TestSpecialisedExplanations.test_eq_text _________________
|
||||
|
||||
self = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef>
|
||||
|
@ -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 = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef>
|
||||
|
@ -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 = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef>
|
||||
|
@ -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 = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef>
|
||||
|
@ -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 = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef>
|
||||
|
@ -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 = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef>
|
||||
|
@ -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 = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef>
|
||||
|
@ -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 = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef>
|
||||
|
@ -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 = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef>
|
||||
|
@ -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 = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef>
|
||||
|
@ -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 = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef>
|
||||
|
@ -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 = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef>
|
||||
|
@ -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 = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef>
|
||||
|
@ -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 = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef>
|
||||
|
@ -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 = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef>
|
||||
|
@ -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 = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef>
|
||||
|
@ -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 = <failure_demo.TestSpecialisedExplanations object at 0xdeadbeef>
|
||||
|
@ -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 = <failure_demo.test_attribute.<locals>.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 = <failure_demo.test_attribute_instance.<locals>.Foo object at 0xdeadbeef>.b
|
||||
E + where <failure_demo.test_attribute_instance.<locals>.Foo object at 0xdeadbeef> = <class 'failure_demo.test_attribute_instance.<locals>.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 = <failure_demo.test_attribute_failure.<locals>.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 = <failure_demo.test_attribute_multiple.<locals>.Bar object at 0xdeadbeef>.b
|
||||
E + where <failure_demo.test_attribute_multiple.<locals>.Bar object at 0xdeadbeef> = <class 'failure_demo.test_attribute_multiple.<locals>.Bar'>()
|
||||
|
||||
failure_demo.py:157: AssertionError
|
||||
failure_demo.py:156: AssertionError
|
||||
__________________________ TestRaises.test_raises __________________________
|
||||
|
||||
self = <failure_demo.TestRaises object at 0xdeadbeef>
|
||||
|
@ -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 = <failure_demo.TestRaises object at 0xdeadbeef>
|
||||
|
@ -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 <class 'OSError'>
|
||||
|
||||
failure_demo.py:170: Failed
|
||||
failure_demo.py:169: Failed
|
||||
__________________________ TestRaises.test_raise ___________________________
|
||||
|
||||
self = <failure_demo.TestRaises object at 0xdeadbeef>
|
||||
|
@ -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 = <failure_demo.TestRaises object at 0xdeadbeef>
|
||||
|
@ -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 = <failure_demo.TestRaises object at 0xdeadbeef>
|
||||
|
@ -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 = <failure_demo.TestMoreErrors object at 0xdeadbeef>
|
||||
|
@ -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 = <failure_demo.TestMoreErrors object at 0xdeadbeef>
|
||||
|
@ -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 = <failure_demo.TestMoreErrors object at 0xdeadbeef>
|
||||
|
@ -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 = <failure_demo.TestMoreErrors object at 0xdeadbeef>
|
||||
|
@ -531,7 +542,7 @@ Here is a nice run of several failures and how ``pytest`` presents things:
|
|||
E + where False = <built-in method startswith of str object at 0xdeadbeef>('456')
|
||||
E + where <built-in method startswith of str object at 0xdeadbeef> = '123'.startswith
|
||||
|
||||
failure_demo.py:227: AssertionError
|
||||
failure_demo.py:226: AssertionError
|
||||
__________________ TestMoreErrors.test_startswith_nested ___________________
|
||||
|
||||
self = <failure_demo.TestMoreErrors object at 0xdeadbeef>
|
||||
|
@ -550,7 +561,7 @@ Here is a nice run of several failures and how ``pytest`` presents things:
|
|||
E + where '123' = <function TestMoreErrors.test_startswith_nested.<locals>.f at 0xdeadbeef>()
|
||||
E + and '456' = <function TestMoreErrors.test_startswith_nested.<locals>.g at 0xdeadbeef>()
|
||||
|
||||
failure_demo.py:236: AssertionError
|
||||
failure_demo.py:235: AssertionError
|
||||
_____________________ TestMoreErrors.test_global_func ______________________
|
||||
|
||||
self = <failure_demo.TestMoreErrors object at 0xdeadbeef>
|
||||
|
@ -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 = <failure_demo.TestMoreErrors object at 0xdeadbeef>
|
||||
|
@ -572,7 +583,7 @@ Here is a nice run of several failures and how ``pytest`` presents things:
|
|||
E assert 42 != 42
|
||||
E + where 42 = <failure_demo.TestMoreErrors object at 0xdeadbeef>.x
|
||||
|
||||
failure_demo.py:243: AssertionError
|
||||
failure_demo.py:242: AssertionError
|
||||
_______________________ TestMoreErrors.test_compare ________________________
|
||||
|
||||
self = <failure_demo.TestMoreErrors object at 0xdeadbeef>
|
||||
|
@ -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 = <failure_demo.TestMoreErrors object at 0xdeadbeef>
|
||||
|
@ -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 = <failure_demo.TestCustomAssertMsg object at 0xdeadbeef>
|
||||
|
@ -608,7 +619,7 @@ Here is a nice run of several failures and how ``pytest`` presents things:
|
|||
E assert 1 == 2
|
||||
E + where 1 = <class 'failure_demo.TestCustomAssertMsg.test_single_line.<locals>.A'>.a
|
||||
|
||||
failure_demo.py:262: AssertionError
|
||||
failure_demo.py:261: AssertionError
|
||||
____________________ TestCustomAssertMsg.test_multiline ____________________
|
||||
|
||||
self = <failure_demo.TestCustomAssertMsg object at 0xdeadbeef>
|
||||
|
@ -627,7 +638,7 @@ Here is a nice run of several failures and how ``pytest`` presents things:
|
|||
E assert 1 == 2
|
||||
E + where 1 = <class 'failure_demo.TestCustomAssertMsg.test_multiline.<locals>.A'>.a
|
||||
|
||||
failure_demo.py:269: AssertionError
|
||||
failure_demo.py:268: AssertionError
|
||||
___________________ TestCustomAssertMsg.test_custom_repr ___________________
|
||||
|
||||
self = <failure_demo.TestCustomAssertMsg object at 0xdeadbeef>
|
||||
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
<Module test_anothersmtp.py>
|
||||
<Function test_showhelo[smtp.gmail.com]>
|
||||
<Function test_showhelo[mail.python.org]>
|
||||
|
@ -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
|
||||
|
|
|
@ -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 = <test_class_demo.TestClassDemoInstance object at 0xdeadbeef>
|
||||
|
||||
self = <test_example.TestClassDemoInstance object at 0x0000019BBB9EEDA0>
|
||||
request = <FixtureRequest for <Function test_one>>
|
||||
|
||||
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 = <test_example.TestClassDemoInstance object at 0x0000019BBB9F3D68>
|
||||
request = <FixtureRequest for <Function test_two>>
|
||||
self = <test_class_demo.TestClassDemoInstance object at 0xdeadbeef>
|
||||
|
||||
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
|
||||
--------------------------------------------------------------
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue