Merge remote-tracking branch 'upstream/master' into release-3.6.0
This commit is contained in:
commit
c55db1faac
1
AUTHORS
1
AUTHORS
|
@ -146,6 +146,7 @@ Michael Seifert
|
|||
Michal Wajszczuk
|
||||
Mihai Capotă
|
||||
Mike Lundy
|
||||
Miro Hrončok
|
||||
Nathaniel Waisbrot
|
||||
Ned Batchelder
|
||||
Neven Mundar
|
||||
|
|
|
@ -40,11 +40,11 @@ MODULE_NOT_FOUND_ERROR = 'ModuleNotFoundError' if PY36 else 'ImportError'
|
|||
|
||||
if _PY3:
|
||||
from collections.abc import MutableMapping as MappingMixin # noqa
|
||||
from collections.abc import Sequence # noqa
|
||||
from collections.abc import Mapping, Sequence # noqa
|
||||
else:
|
||||
# those raise DeprecationWarnings in Python >=3.7
|
||||
from collections import MutableMapping as MappingMixin # noqa
|
||||
from collections import Sequence # noqa
|
||||
from collections import Mapping, Sequence # noqa
|
||||
|
||||
|
||||
def _format_args(func):
|
||||
|
|
|
@ -177,7 +177,7 @@ class PytestPluginManager(PluginManager):
|
|||
"""
|
||||
|
||||
def __init__(self):
|
||||
super(PytestPluginManager, self).__init__("pytest", implprefix="pytest_")
|
||||
super(PytestPluginManager, self).__init__("pytest")
|
||||
self._conftest_plugins = set()
|
||||
|
||||
# state related to local conftest plugins
|
||||
|
@ -231,6 +231,11 @@ class PytestPluginManager(PluginManager):
|
|||
|
||||
method = getattr(plugin, name)
|
||||
opts = super(PytestPluginManager, self).parse_hookimpl_opts(plugin, name)
|
||||
|
||||
# collect unmarked hooks as long as they have the `pytest_' prefix
|
||||
if opts is None and name.startswith("pytest_"):
|
||||
opts = {}
|
||||
|
||||
if opts is not None:
|
||||
for name in ("tryfirst", "trylast", "optionalhook", "hookwrapper"):
|
||||
opts.setdefault(name, hasattr(method, name))
|
||||
|
|
|
@ -426,7 +426,7 @@ def approx(expected, rel=None, abs=None, nan_ok=False):
|
|||
__ https://docs.python.org/3/reference/datamodel.html#object.__ge__
|
||||
"""
|
||||
|
||||
from collections import Mapping, Sequence
|
||||
from _pytest.compat import Mapping, Sequence
|
||||
from _pytest.compat import STRING_TYPES as String
|
||||
from decimal import Decimal
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
Detect `pytest_` prefixed hooks using the internal plugin
|
||||
manager since ``pluggy`` is deprecating the ``implprefix``
|
||||
argument to ``PluginManager``.
|
|
@ -0,0 +1,5 @@
|
|||
Import ``Mapping`` and ``Sequence`` from ``_pytest.compat`` instead of directly
|
||||
from ``collections`` in ``python_api.py::approx``. Add ``Mapping`` to
|
||||
``_pytest.compat``, import it from ``collections`` on python 2, but from
|
||||
``collections.abc`` on Python 3 to avoid a ``DeprecationWarning`` on
|
||||
Python 3.7 or newer.
|
|
@ -123,7 +123,7 @@ You can call ``caplog.clear()`` to reset the captured log records in a test::
|
|||
assert ['Foo'] == [rec.message for rec in caplog.records]
|
||||
|
||||
|
||||
The ``caplop.records`` attribute contains records from the current stage only, so
|
||||
The ``caplog.records`` attribute contains records from the current stage only, so
|
||||
inside the ``setup`` phase it contains only setup logs, same with the ``call`` and
|
||||
``teardown`` phases.
|
||||
|
||||
|
|
Loading…
Reference in New Issue