Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ad20b533f | ||
|
|
9df5267648 | ||
|
|
1521849c87 | ||
|
|
bcb94c4c8b | ||
|
|
0f83df4f55 | ||
|
|
330caac2ca | ||
|
|
08a1ab3a8a | ||
|
|
868bc003ec |
@@ -1 +0,0 @@
|
||||
Removed faq.rst and its reference in contents.rst.
|
||||
@@ -1,20 +0,0 @@
|
||||
Fixed error when overwriting a parametrized fixture, while also reusing the super fixture value.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# conftest.py
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture(params=[1, 2])
|
||||
def foo(request):
|
||||
return request.param
|
||||
|
||||
|
||||
# test_foo.py
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def foo(foo):
|
||||
return foo * 2
|
||||
@@ -1,3 +0,0 @@
|
||||
Fixed an internal error crash with ``IndexError: list index out of range`` when
|
||||
collecting a module which starts with a decorated function, the decorator
|
||||
raises, and assertion rewriting is enabled.
|
||||
@@ -1,18 +0,0 @@
|
||||
As per our policy, the following features which have been deprecated in the 5.X series are now
|
||||
removed:
|
||||
|
||||
* The ``funcargnames`` read-only property of ``FixtureRequest``, ``Metafunc``, and ``Function`` classes. Use ``fixturenames`` attribute.
|
||||
|
||||
* ``@pytest.fixture`` no longer supports positional arguments, pass all arguments by keyword instead.
|
||||
|
||||
* Direct construction of ``Node`` subclasses now raise an error, use ``from_parent`` instead.
|
||||
|
||||
* The default value for ``junit_family`` has changed to ``xunit2``. If you require the old format, add ``junit_family=xunit1`` to your configuration file.
|
||||
|
||||
* The ``TerminalReporter`` no longer has a ``writer`` attribute. Plugin authors may use the public functions of the ``TerminalReporter`` instead of accessing the ``TerminalWriter`` object directly.
|
||||
|
||||
* The ``--result-log`` option has been removed. Users are recommended to use the `pytest-reportlog <https://github.com/pytest-dev/pytest-reportlog>`__ plugin instead.
|
||||
|
||||
|
||||
For more information consult
|
||||
`Deprecations and Removals <https://docs.pytest.org/en/stable/deprecations.html>`__ in the docs.
|
||||
@@ -1,3 +0,0 @@
|
||||
Internal pytest warnings issued during the early stages of initialization are now properly handled and can filtered through :confval:`filterwarnings` or ``--pythonwarnings/-W``.
|
||||
|
||||
This also fixes a number of long standing issues: `#2891 <https://github.com/pytest-dev/pytest/issues/2891>`__, `#7620 <https://github.com/pytest-dev/pytest/issues/7620>`__, `#7426 <https://github.com/pytest-dev/pytest/issues/7426>`__.
|
||||
@@ -1 +0,0 @@
|
||||
The ``pytest.collect`` module is deprecated: all its names can be imported from ``pytest`` directly.
|
||||
@@ -1,6 +0,0 @@
|
||||
The ``pytest._fillfuncargs`` function is 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,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 @@
|
||||
The :func:`pytest_warning_captured <_pytest.hookspec.pytest_warning_captured>` hook is deprecated in favor
|
||||
of :func:`pytest_warning_recorded <_pytest.hookspec.pytest_warning_recorded>`, and will be removed in a future version.
|
||||
@@ -1,3 +0,0 @@
|
||||
The internal ``junitxml`` plugin has rewritten to use ``xml.etree.ElementTree``.
|
||||
The order of attributes in XML elements might differ. Some unneeded escaping is
|
||||
no longer performed.
|
||||
@@ -1 +0,0 @@
|
||||
When a plugin listed in ``required_plugins`` is missing or an unknown config key is used with ``--strict-config``, a simple error message is now shown instead of a stacktrace.
|
||||
@@ -1 +0,0 @@
|
||||
The dependency on the ``more-itertools`` package has been removed.
|
||||
@@ -1 +0,0 @@
|
||||
pylint shouldn't complain anymore about unimplemented abstract methods when inheriting from :ref:`File <non-python tests>`.
|
||||
@@ -1 +0,0 @@
|
||||
Fixed test collection when a full path without a drive letter was passed to pytest on Windows (for example ``\projects\tests\test.py`` instead of ``c:\projects\tests\pytest.py``).
|
||||
@@ -1,2 +0,0 @@
|
||||
The result type of :meth:`capfd.readouterr() <_pytest.capture.CaptureFixture.readouterr>` (and similar) is no longer a namedtuple,
|
||||
but should behave like one in all respects. This was done for technical reasons.
|
||||
@@ -1 +0,0 @@
|
||||
Fix handling of command-line options that appear as paths but trigger an OS-level syntax error on Windows, such as the options used internally by ``pytest-xdist``.
|
||||
@@ -1,3 +0,0 @@
|
||||
The ``gethookproxy()`` and ``isinitpath()`` methods of ``FSCollector`` and ``Package`` are deprecated;
|
||||
use ``self.session.gethookproxy()`` and ``self.session.isinitpath()`` instead.
|
||||
This should work on all pytest versions.
|
||||
@@ -1 +0,0 @@
|
||||
New ``--durations-min`` command-line flag controls the minimal duration for inclusion in the slowest list of tests shown by ``--durations``. Previously this was hard-coded to ``0.005s``.
|
||||
@@ -1,6 +0,0 @@
|
||||
When collecting tests, pytest finds test classes and functions by examining the
|
||||
attributes of python objects (modules, classes and instances). To speed up this
|
||||
process, pytest now ignores builtin attributes (like ``__class__``,
|
||||
``__delattr__`` and ``__new__``) without consulting the :confval:`python_classes` and
|
||||
:confval:`python_functions` configuration options and without passing them to plugins
|
||||
using the :func:`pytest_pycollect_makeitem <_pytest.hookspec.pytest_pycollect_makeitem>` hook.
|
||||
@@ -1,3 +0,0 @@
|
||||
Added two new attributes :attr:`rootpath <_pytest.config.Config.rootpath>` and :attr:`inipath <_pytest.config.Config.inipath>` to :class:`Config <_pytest.config.Config>`.
|
||||
These attributes are :class:`pathlib.Path` versions of the existing :attr:`rootdir <_pytest.config.Config.rootdir>` and :attr:`inifile <_pytest.config.Config.inifile>` attributes,
|
||||
and should be preferred over them when possible.
|
||||
@@ -1 +0,0 @@
|
||||
Fixed INTERNALERROR when accessing locals / globals with faulty ``exec``.
|
||||
@@ -1,3 +0,0 @@
|
||||
Public classes which are not designed to be inherited from are now marked `@final <https://docs.python.org/3/library/typing.html#typing.final>`_.
|
||||
Code which inherits from these classes will trigger a type-checking (e.g. mypy) error, but will still work in runtime.
|
||||
Currently the ``final`` designation does not appear in the API Reference but hopefully will in the future.
|
||||
@@ -6,6 +6,8 @@ Release announcements
|
||||
:maxdepth: 2
|
||||
|
||||
|
||||
release-6.1.1
|
||||
release-6.1.0
|
||||
release-6.0.2
|
||||
release-6.0.1
|
||||
release-6.0.0
|
||||
|
||||
44
doc/en/announce/release-6.1.0.rst
Normal file
44
doc/en/announce/release-6.1.0.rst
Normal file
@@ -0,0 +1,44 @@
|
||||
pytest-6.1.0
|
||||
=======================================
|
||||
|
||||
The pytest team is proud to announce the 6.1.0 release!
|
||||
|
||||
This release contains new features, improvements, bug fixes, and breaking changes, so users
|
||||
are encouraged to take a look at the CHANGELOG carefully:
|
||||
|
||||
https://docs.pytest.org/en/stable/changelog.html
|
||||
|
||||
For complete documentation, please visit:
|
||||
|
||||
https://docs.pytest.org/en/stable/
|
||||
|
||||
As usual, you can upgrade from PyPI via:
|
||||
|
||||
pip install -U pytest
|
||||
|
||||
Thanks to all of the contributors to this release:
|
||||
|
||||
* Anthony Sottile
|
||||
* Bruno Oliveira
|
||||
* C. Titus Brown
|
||||
* Drew Devereux
|
||||
* Faris A Chugthai
|
||||
* Florian Bruhin
|
||||
* Hugo van Kemenade
|
||||
* Hynek Schlawack
|
||||
* Joseph Lucas
|
||||
* Kamran Ahmad
|
||||
* Mattreex
|
||||
* Maximilian Cosmo Sitter
|
||||
* Ran Benita
|
||||
* Rüdiger Busche
|
||||
* Sam Estep
|
||||
* Sorin Sbarnea
|
||||
* Thomas Grainger
|
||||
* Vipul Kumar
|
||||
* Yutaro Ikeda
|
||||
* hp310780
|
||||
|
||||
|
||||
Happy testing,
|
||||
The pytest Development Team
|
||||
18
doc/en/announce/release-6.1.1.rst
Normal file
18
doc/en/announce/release-6.1.1.rst
Normal file
@@ -0,0 +1,18 @@
|
||||
pytest-6.1.1
|
||||
=======================================
|
||||
|
||||
pytest 6.1.1 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/stable/changelog.html.
|
||||
|
||||
Thanks to all of the contributors to this release:
|
||||
|
||||
* Ran Benita
|
||||
|
||||
|
||||
Happy testing,
|
||||
The pytest Development Team
|
||||
@@ -23,7 +23,7 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
|
||||
cache.get(key, default)
|
||||
cache.set(key, value)
|
||||
|
||||
Keys must be a ``/`` separated value, where the first part is usually the
|
||||
Keys must be ``/`` separated strings, where the first part is usually the
|
||||
name of your plugin or application to avoid clashes with other cache users.
|
||||
|
||||
Values can be any object handled by the json stdlib module.
|
||||
@@ -57,7 +57,8 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
|
||||
``out`` and ``err`` will be ``byte`` objects.
|
||||
|
||||
doctest_namespace [session scope]
|
||||
Fixture that returns a :py:class:`dict` that will be injected into the namespace of doctests.
|
||||
Fixture that returns a :py:class:`dict` that will be injected into the
|
||||
namespace of doctests.
|
||||
|
||||
pytestconfig [session scope]
|
||||
Session-scoped fixture that returns the :class:`_pytest.config.Config` object.
|
||||
@@ -89,8 +90,10 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
|
||||
automatically XML-encoded.
|
||||
|
||||
record_testsuite_property [session scope]
|
||||
Records a new ``<property>`` tag as child of the root ``<testsuite>``. This is suitable to
|
||||
writing global information regarding the entire test suite, and is compatible with ``xunit2`` JUnit family.
|
||||
Record a new ``<property>`` tag as child of the root ``<testsuite>``.
|
||||
|
||||
This is suitable to writing global information regarding the entire test
|
||||
suite, and is compatible with ``xunit2`` JUnit family.
|
||||
|
||||
This is a ``session``-scoped fixture which is called with ``(name, value)``. Example:
|
||||
|
||||
@@ -102,6 +105,12 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
|
||||
|
||||
``name`` must be a string, ``value`` will be converted to a string and properly xml-escaped.
|
||||
|
||||
.. warning::
|
||||
|
||||
Currently this fixture **does not work** with the
|
||||
`pytest-xdist <https://github.com/pytest-dev/pytest-xdist>`__ plugin. See issue
|
||||
`#7767 <https://github.com/pytest-dev/pytest/issues/7767>`__ for details.
|
||||
|
||||
caplog
|
||||
Access and control log capturing.
|
||||
|
||||
@@ -114,8 +123,10 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
|
||||
* caplog.clear() -> clear captured records and formatted log output string
|
||||
|
||||
monkeypatch
|
||||
The returned ``monkeypatch`` fixture provides these
|
||||
helper methods to modify objects, dictionaries or os.environ::
|
||||
A convenient fixture for monkey-patching.
|
||||
|
||||
The fixture provides these methods to modify objects, dictionaries or
|
||||
os.environ::
|
||||
|
||||
monkeypatch.setattr(obj, name, value, raising=True)
|
||||
monkeypatch.delattr(obj, name, raising=True)
|
||||
@@ -126,10 +137,9 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
|
||||
monkeypatch.syspath_prepend(path)
|
||||
monkeypatch.chdir(path)
|
||||
|
||||
All modifications will be undone after the requesting
|
||||
test function or fixture has finished. The ``raising``
|
||||
parameter determines if a KeyError or AttributeError
|
||||
will be raised if the set/deletion operation has no target.
|
||||
All modifications will be undone after the requesting test function or
|
||||
fixture has finished. The ``raising`` parameter determines if a KeyError
|
||||
or AttributeError will be raised if the set/deletion operation has no target.
|
||||
|
||||
recwarn
|
||||
Return a :class:`WarningsRecorder` instance that records all warnings emitted by test functions.
|
||||
@@ -140,30 +150,28 @@ For information about fixtures, see :ref:`fixtures`. To see a complete list of a
|
||||
tmpdir_factory [session scope]
|
||||
Return a :class:`_pytest.tmpdir.TempdirFactory` instance for the test session.
|
||||
|
||||
|
||||
tmp_path_factory [session scope]
|
||||
Return a :class:`_pytest.tmpdir.TempPathFactory` instance for the test session.
|
||||
|
||||
|
||||
tmpdir
|
||||
Return a temporary directory path object
|
||||
which is unique to each test function invocation,
|
||||
created as a sub directory of the base temporary
|
||||
directory. The returned object is a `py.path.local`_
|
||||
path object.
|
||||
Return a temporary directory path object which is unique to each test
|
||||
function invocation, created as a sub directory of the base temporary
|
||||
directory.
|
||||
|
||||
The returned object is a `py.path.local`_ path object.
|
||||
|
||||
.. _`py.path.local`: https://py.readthedocs.io/en/latest/path.html
|
||||
|
||||
tmp_path
|
||||
Return a temporary directory path object
|
||||
which is unique to each test function invocation,
|
||||
created as a sub directory of the base temporary
|
||||
directory. The returned object is a :class:`pathlib.Path`
|
||||
object.
|
||||
Return a temporary directory path object which is unique to each test
|
||||
function invocation, created as a sub directory of the base temporary
|
||||
directory.
|
||||
|
||||
The returned object is a :class:`pathlib.Path` object.
|
||||
|
||||
.. note::
|
||||
|
||||
in python < 3.6 this is a pathlib2.Path
|
||||
In python < 3.6 this is a pathlib2.Path.
|
||||
|
||||
|
||||
no tests ran in 0.12s
|
||||
|
||||
@@ -28,6 +28,178 @@ with advance notice in the **Deprecations** section of releases.
|
||||
|
||||
.. towncrier release notes start
|
||||
|
||||
pytest 6.1.1 (2020-10-03)
|
||||
=========================
|
||||
|
||||
Bug Fixes
|
||||
---------
|
||||
|
||||
- `#7807 <https://github.com/pytest-dev/pytest/issues/7807>`_: Fixed regression in pytest 6.1.0 causing incorrect rootdir to be determined in some non-trivial cases where parent directories have config files as well.
|
||||
|
||||
|
||||
- `#7814 <https://github.com/pytest-dev/pytest/issues/7814>`_: Fixed crash in header reporting when :confval:`testpaths` is used and contains absolute paths (regression in 6.1.0).
|
||||
|
||||
|
||||
pytest 6.1.0 (2020-09-26)
|
||||
=========================
|
||||
|
||||
Breaking Changes
|
||||
----------------
|
||||
|
||||
- `#5585 <https://github.com/pytest-dev/pytest/issues/5585>`_: As per our policy, the following features which have been deprecated in the 5.X series are now
|
||||
removed:
|
||||
|
||||
* The ``funcargnames`` read-only property of ``FixtureRequest``, ``Metafunc``, and ``Function`` classes. Use ``fixturenames`` attribute.
|
||||
|
||||
* ``@pytest.fixture`` no longer supports positional arguments, pass all arguments by keyword instead.
|
||||
|
||||
* Direct construction of ``Node`` subclasses now raise an error, use ``from_parent`` instead.
|
||||
|
||||
* The default value for ``junit_family`` has changed to ``xunit2``. If you require the old format, add ``junit_family=xunit1`` to your configuration file.
|
||||
|
||||
* The ``TerminalReporter`` no longer has a ``writer`` attribute. Plugin authors may use the public functions of the ``TerminalReporter`` instead of accessing the ``TerminalWriter`` object directly.
|
||||
|
||||
* The ``--result-log`` option has been removed. Users are recommended to use the `pytest-reportlog <https://github.com/pytest-dev/pytest-reportlog>`__ plugin instead.
|
||||
|
||||
|
||||
For more information consult
|
||||
`Deprecations and Removals <https://docs.pytest.org/en/stable/deprecations.html>`__ in the docs.
|
||||
|
||||
|
||||
|
||||
Deprecations
|
||||
------------
|
||||
|
||||
- `#6981 <https://github.com/pytest-dev/pytest/issues/6981>`_: The ``pytest.collect`` module is deprecated: all its names can be imported from ``pytest`` directly.
|
||||
|
||||
|
||||
- `#7097 <https://github.com/pytest-dev/pytest/issues/7097>`_: The ``pytest._fillfuncargs`` function is 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.
|
||||
|
||||
|
||||
- `#7255 <https://github.com/pytest-dev/pytest/issues/7255>`_: The :func:`pytest_warning_captured <_pytest.hookspec.pytest_warning_captured>` hook is deprecated in favor
|
||||
of :func:`pytest_warning_recorded <_pytest.hookspec.pytest_warning_recorded>`, and will be removed in a future version.
|
||||
|
||||
|
||||
- `#7648 <https://github.com/pytest-dev/pytest/issues/7648>`_: The ``gethookproxy()`` and ``isinitpath()`` methods of ``FSCollector`` and ``Package`` are deprecated;
|
||||
use ``self.session.gethookproxy()`` and ``self.session.isinitpath()`` instead.
|
||||
This should work on all pytest versions.
|
||||
|
||||
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
- `#7667 <https://github.com/pytest-dev/pytest/issues/7667>`_: New ``--durations-min`` command-line flag controls the minimal duration for inclusion in the slowest list of tests shown by ``--durations``. Previously this was hard-coded to ``0.005s``.
|
||||
|
||||
|
||||
|
||||
Improvements
|
||||
------------
|
||||
|
||||
- `#6681 <https://github.com/pytest-dev/pytest/issues/6681>`_: Internal pytest warnings issued during the early stages of initialization are now properly handled and can filtered through :confval:`filterwarnings` or ``--pythonwarnings/-W``.
|
||||
|
||||
This also fixes a number of long standing issues: `#2891 <https://github.com/pytest-dev/pytest/issues/2891>`__, `#7620 <https://github.com/pytest-dev/pytest/issues/7620>`__, `#7426 <https://github.com/pytest-dev/pytest/issues/7426>`__.
|
||||
|
||||
|
||||
- `#7572 <https://github.com/pytest-dev/pytest/issues/7572>`_: When a plugin listed in ``required_plugins`` is missing or an unknown config key is used with ``--strict-config``, a simple error message is now shown instead of a stacktrace.
|
||||
|
||||
|
||||
- `#7685 <https://github.com/pytest-dev/pytest/issues/7685>`_: Added two new attributes :attr:`rootpath <_pytest.config.Config.rootpath>` and :attr:`inipath <_pytest.config.Config.inipath>` to :class:`Config <_pytest.config.Config>`.
|
||||
These attributes are :class:`pathlib.Path` versions of the existing :attr:`rootdir <_pytest.config.Config.rootdir>` and :attr:`inifile <_pytest.config.Config.inifile>` attributes,
|
||||
and should be preferred over them when possible.
|
||||
|
||||
|
||||
- `#7780 <https://github.com/pytest-dev/pytest/issues/7780>`_: Public classes which are not designed to be inherited from are now marked `@final <https://docs.python.org/3/library/typing.html#typing.final>`_.
|
||||
Code which inherits from these classes will trigger a type-checking (e.g. mypy) error, but will still work in runtime.
|
||||
Currently the ``final`` designation does not appear in the API Reference but hopefully will in the future.
|
||||
|
||||
|
||||
|
||||
Bug Fixes
|
||||
---------
|
||||
|
||||
- `#1953 <https://github.com/pytest-dev/pytest/issues/1953>`_: Fixed error when overwriting a parametrized fixture, while also reusing the super fixture value.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# conftest.py
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture(params=[1, 2])
|
||||
def foo(request):
|
||||
return request.param
|
||||
|
||||
|
||||
# test_foo.py
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def foo(foo):
|
||||
return foo * 2
|
||||
|
||||
|
||||
- `#4984 <https://github.com/pytest-dev/pytest/issues/4984>`_: Fixed an internal error crash with ``IndexError: list index out of range`` when
|
||||
collecting a module which starts with a decorated function, the decorator
|
||||
raises, and assertion rewriting is enabled.
|
||||
|
||||
|
||||
- `#7591 <https://github.com/pytest-dev/pytest/issues/7591>`_: pylint shouldn't complain anymore about unimplemented abstract methods when inheriting from :ref:`File <non-python tests>`.
|
||||
|
||||
|
||||
- `#7628 <https://github.com/pytest-dev/pytest/issues/7628>`_: Fixed test collection when a full path without a drive letter was passed to pytest on Windows (for example ``\projects\tests\test.py`` instead of ``c:\projects\tests\pytest.py``).
|
||||
|
||||
|
||||
- `#7638 <https://github.com/pytest-dev/pytest/issues/7638>`_: Fix handling of command-line options that appear as paths but trigger an OS-level syntax error on Windows, such as the options used internally by ``pytest-xdist``.
|
||||
|
||||
|
||||
- `#7742 <https://github.com/pytest-dev/pytest/issues/7742>`_: Fixed INTERNALERROR when accessing locals / globals with faulty ``exec``.
|
||||
|
||||
|
||||
|
||||
Improved Documentation
|
||||
----------------------
|
||||
|
||||
- `#1477 <https://github.com/pytest-dev/pytest/issues/1477>`_: Removed faq.rst and its reference in contents.rst.
|
||||
|
||||
|
||||
|
||||
Trivial/Internal Changes
|
||||
------------------------
|
||||
|
||||
- `#7536 <https://github.com/pytest-dev/pytest/issues/7536>`_: The internal ``junitxml`` plugin has rewritten to use ``xml.etree.ElementTree``.
|
||||
The order of attributes in XML elements might differ. Some unneeded escaping is
|
||||
no longer performed.
|
||||
|
||||
|
||||
- `#7587 <https://github.com/pytest-dev/pytest/issues/7587>`_: The dependency on the ``more-itertools`` package has been removed.
|
||||
|
||||
|
||||
- `#7631 <https://github.com/pytest-dev/pytest/issues/7631>`_: The result type of :meth:`capfd.readouterr() <_pytest.capture.CaptureFixture.readouterr>` (and similar) is no longer a namedtuple,
|
||||
but should behave like one in all respects. This was done for technical reasons.
|
||||
|
||||
|
||||
- `#7671 <https://github.com/pytest-dev/pytest/issues/7671>`_: When collecting tests, pytest finds test classes and functions by examining the
|
||||
attributes of python objects (modules, classes and instances). To speed up this
|
||||
process, pytest now ignores builtin attributes (like ``__class__``,
|
||||
``__delattr__`` and ``__new__``) without consulting the :confval:`python_classes` and
|
||||
:confval:`python_functions` configuration options and without passing them to plugins
|
||||
using the :func:`pytest_pycollect_makeitem <_pytest.hookspec.pytest_pycollect_makeitem>` hook.
|
||||
|
||||
|
||||
pytest 6.0.2 (2020-09-04)
|
||||
=========================
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ Install ``pytest``
|
||||
.. code-block:: bash
|
||||
|
||||
$ pytest --version
|
||||
pytest 6.0.2
|
||||
pytest 6.1.1
|
||||
|
||||
.. _`simpletest`:
|
||||
|
||||
|
||||
@@ -33,26 +33,34 @@ Plugin discovery order at tool startup
|
||||
|
||||
``pytest`` loads plugin modules at tool startup in the following way:
|
||||
|
||||
* by loading all builtin plugins
|
||||
1. by scanning the command line for the ``-p no:name`` option
|
||||
and *blocking* that plugin from being loaded (even builtin plugins can
|
||||
be blocked this way). This happens before normal command-line parsing.
|
||||
|
||||
* by loading all plugins registered through `setuptools entry points`_.
|
||||
2. by loading all builtin plugins.
|
||||
|
||||
* by pre-scanning the command line for the ``-p name`` option
|
||||
and loading the specified plugin before actual command line parsing.
|
||||
3. by scanning the command line for the ``-p name`` option
|
||||
and loading the specified plugin. This happens before normal command-line parsing.
|
||||
|
||||
* by loading all :file:`conftest.py` files as inferred by the command line
|
||||
invocation:
|
||||
4. by loading all plugins registered through `setuptools entry points`_.
|
||||
|
||||
- if no test paths are specified use current dir as a test path
|
||||
- if exists, load ``conftest.py`` and ``test*/conftest.py`` relative
|
||||
to the directory part of the first test path.
|
||||
5. by loading all plugins specified through the :envvar:`PYTEST_PLUGINS` environment variable.
|
||||
|
||||
Note that pytest does not find ``conftest.py`` files in deeper nested
|
||||
sub directories at tool startup. It is usually a good idea to keep
|
||||
your ``conftest.py`` file in the top level test or project root directory.
|
||||
6. by loading all :file:`conftest.py` files as inferred by the command line
|
||||
invocation:
|
||||
|
||||
* by recursively loading all plugins specified by the
|
||||
:globalvar:`pytest_plugins` variable in ``conftest.py`` files
|
||||
- if no test paths are specified, use the current dir as a test path
|
||||
- if exists, load ``conftest.py`` and ``test*/conftest.py`` relative
|
||||
to the directory part of the first test path. After the ``conftest.py``
|
||||
file is loaded, load all plugins specified in its
|
||||
:globalvar:`pytest_plugins` variable if present.
|
||||
|
||||
Note that pytest does not find ``conftest.py`` files in deeper nested
|
||||
sub directories at tool startup. It is usually a good idea to keep
|
||||
your ``conftest.py`` file in the top level test or project root directory.
|
||||
|
||||
7. by recursively loading all plugins specified by the
|
||||
:globalvar:`pytest_plugins` variable in ``conftest.py`` files.
|
||||
|
||||
|
||||
.. _`pytest/plugin`: http://bitbucket.org/pytest-dev/pytest/src/tip/pytest/plugin/
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import itertools
|
||||
import os
|
||||
from typing import Dict
|
||||
from typing import Iterable
|
||||
@@ -100,7 +99,7 @@ def locate_config(
|
||||
args = [Path.cwd()]
|
||||
for arg in args:
|
||||
argpath = absolutepath(arg)
|
||||
for base in itertools.chain((argpath,), reversed(argpath.parents)):
|
||||
for base in (argpath, *argpath.parents):
|
||||
for config_name in config_names:
|
||||
p = base / config_name
|
||||
if p.is_file():
|
||||
@@ -184,9 +183,7 @@ def determine_setup(
|
||||
ancestor = get_common_ancestor(dirs)
|
||||
rootdir, inipath, inicfg = locate_config([ancestor])
|
||||
if rootdir is None and rootdir_cmd_arg is None:
|
||||
for possible_rootdir in itertools.chain(
|
||||
(ancestor,), reversed(ancestor.parents)
|
||||
):
|
||||
for possible_rootdir in (ancestor, *ancestor.parents):
|
||||
if (possible_rootdir / "setup.py").is_file():
|
||||
rootdir = possible_rootdir
|
||||
break
|
||||
|
||||
@@ -718,10 +718,10 @@ class TerminalReporter:
|
||||
if config.inipath:
|
||||
line += ", configfile: " + bestrelpath(config.rootpath, config.inipath)
|
||||
|
||||
testpaths = config.getini("testpaths")
|
||||
testpaths = config.getini("testpaths") # type: List[str]
|
||||
if testpaths and config.args == testpaths:
|
||||
rel_paths = [bestrelpath(config.rootpath, x) for x in testpaths]
|
||||
line += ", testpaths: {}".format(", ".join(rel_paths))
|
||||
line += ", testpaths: {}".format(", ".join(testpaths))
|
||||
|
||||
result = [line]
|
||||
|
||||
plugininfo = config.pluginmanager.list_plugin_distinfo()
|
||||
|
||||
@@ -1375,6 +1375,21 @@ class TestRootdir:
|
||||
assert rootpath == tmp_path
|
||||
assert inipath is None
|
||||
|
||||
def test_with_config_also_in_parent_directory(
|
||||
self, tmp_path: Path, monkeypatch: MonkeyPatch
|
||||
) -> None:
|
||||
"""Regression test for #7807."""
|
||||
(tmp_path / "setup.cfg").write_text("[tool:pytest]\n", "utf-8")
|
||||
(tmp_path / "myproject").mkdir()
|
||||
(tmp_path / "myproject" / "setup.cfg").write_text("[tool:pytest]\n", "utf-8")
|
||||
(tmp_path / "myproject" / "tests").mkdir()
|
||||
monkeypatch.chdir(tmp_path / "myproject")
|
||||
|
||||
rootpath, inipath, _ = determine_setup(None, ["tests/"])
|
||||
|
||||
assert rootpath == tmp_path / "myproject"
|
||||
assert inipath == tmp_path / "myproject" / "setup.cfg"
|
||||
|
||||
|
||||
class TestOverrideIniArgs:
|
||||
@pytest.mark.parametrize("name", "setup.cfg tox.ini pytest.ini".split())
|
||||
|
||||
@@ -18,6 +18,7 @@ import pytest
|
||||
from _pytest._io.wcwidth import wcswidth
|
||||
from _pytest.config import Config
|
||||
from _pytest.config import ExitCode
|
||||
from _pytest.monkeypatch import MonkeyPatch
|
||||
from _pytest.pathlib import Path
|
||||
from _pytest.pytester import Testdir
|
||||
from _pytest.reports import BaseReport
|
||||
@@ -749,6 +750,29 @@ class TestTerminalFunctional:
|
||||
result = testdir.runpytest("tests")
|
||||
result.stdout.fnmatch_lines(["rootdir: *test_header0, configfile: tox.ini"])
|
||||
|
||||
def test_header_absolute_testpath(
|
||||
self, testdir: Testdir, monkeypatch: MonkeyPatch
|
||||
) -> None:
|
||||
"""Regresstion test for #7814."""
|
||||
tests = testdir.tmpdir.join("tests")
|
||||
tests.ensure_dir()
|
||||
testdir.makepyprojecttoml(
|
||||
"""
|
||||
[tool.pytest.ini_options]
|
||||
testpaths = ['{}']
|
||||
""".format(
|
||||
tests
|
||||
)
|
||||
)
|
||||
result = testdir.runpytest()
|
||||
result.stdout.fnmatch_lines(
|
||||
[
|
||||
"rootdir: *absolute_testpath0, configfile: pyproject.toml, testpaths: {}".format(
|
||||
tests
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
def test_no_header(self, testdir):
|
||||
testdir.tmpdir.join("tests").ensure_dir()
|
||||
testdir.tmpdir.join("gui").ensure_dir()
|
||||
|
||||
Reference in New Issue
Block a user