Hello community, here is the log from the commit of package python-pytest for openSUSE:Leap:15.2 checked in at 2020-04-28 20:09:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Leap:15.2/python-pytest (Old) and /work/SRC/openSUSE:Leap:15.2/.python-pytest.new.2738 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pytest" Tue Apr 28 20:09:50 2020 rev:39 rq:795985 version:3.10.1 Changes: -------- --- /work/SRC/openSUSE:Leap:15.2/python-pytest/python-pytest.changes 2020-01-15 15:52:14.491556572 +0100 +++ /work/SRC/openSUSE:Leap:15.2/.python-pytest.new.2738/python-pytest.changes 2020-04-28 20:09:54.284378237 +0200 @@ -2 +2,55 @@ -Wed Jan 30 15:42:16 CET 2019 - mc...@suse.com +Thu Mar 26 07:29:49 UTC 2020 - Tomáš Chvátal <tchva...@suse.com> + +- Skip garbage test https://bugs.python.org/issue23841 +- Update in SLE bsc#1167732 + +------------------------------------------------------------------- +Thu Mar 26 06:15:43 UTC 2020 - Tomáš Chvátal <tchva...@suse.com> + +- Do pull in properly pytest not pytest3 + +------------------------------------------------------------------- +Wed Mar 25 16:28:18 UTC 2020 - Tomáš Chvátal <tchva...@suse.com> + +- Remove docu part so we don't need to pull the dependencies + +------------------------------------------------------------------- +Fri Oct 11 08:11:46 UTC 2019 - Ondřej Súkup <mimi...@gmail.com> + +- add attrs.patch - fix compatibility with attrs-19.2+ + +------------------------------------------------------------------- +Wed Sep 25 09:39:55 UTC 2019 - Tomáš Chvátal <tchva...@suse.com> + +- Revert the importlib-metadata.patch change from last + change and split it to separate patch adding more content: + * importlib-py38.patch + * importlib-metadata.patch + +------------------------------------------------------------------- +Wed Sep 11 11:19:59 UTC 2019 - Tomáš Chvátal <tchva...@suse.com> + +- Update importlib-metadata.patch to not pull in the importlib + on python 3.8+ + +------------------------------------------------------------------- +Tue Jun 11 07:02:25 UTC 2019 - Tomáš Chvátal <tchva...@suse.com> + +- Add missing quotes to the test call + +------------------------------------------------------------------- +Fri Jun 7 11:42:16 UTC 2019 - Tomáš Chvátal <tchva...@suse.com> + +- Add patch to fix build with new sphinx: + * sphinx2.0.patch +- Add patch to fix build with new pluggy that uses importlib-metadata: + * importlib-metadata.patch + +------------------------------------------------------------------- +Tue Feb 26 13:05:11 UTC 2019 - Tomáš Chvátal <tchva...@suse.com> + +- Add patch to build with new pluggy: + * new-pluggy.patch + +------------------------------------------------------------------- +Fri Jan 4 22:08:17 CET 2019 - mc...@suse.com @@ -4 +57,0 @@ -- Sync with Factory (bsc#1123314) New: ---- attrs.patch importlib-metadata.patch importlib-py38.patch new-pluggy.patch sphinx2.0.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pytest.spec ++++++ --- /var/tmp/diff_new_pack.mJdA4h/_old 2020-04-28 20:09:54.856379424 +0200 +++ /var/tmp/diff_new_pack.mJdA4h/_new 2020-04-28 20:09:54.864379441 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-pytest # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,15 +19,13 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %global flavor @BUILD_FLAVOR@%{nil} %if "%{flavor}" == "test" +%define psuffix -test %bcond_without test %else +%define psuffix %{nil} %bcond_with test %endif -%if %{with test} -Name: python-pytest-%{flavor} -%else -Name: python-pytest -%endif +Name: python-pytest%{psuffix} Version: 3.10.1 Release: 0 Summary: Python testing tool with autodiscovery and detailed asserts @@ -37,29 +35,41 @@ Source: https://files.pythonhosted.org/packages/source/p/pytest/pytest-%{version}.tar.gz # PATCH-FIX-UPSTREAM fix_test_raises_exception_looks_iterable.patch gh#pytest-dev/pytest#4525 mc...@suse.com Patch0: fix_test_raises_exception_looks_iterable.patch +# PATCH-FIX-UPSTREAM taken from master +Patch1: new-pluggy.patch +# PATCH-FIX-UPSTREAM from master +Patch2: sphinx2.0.patch +# PATCH-FIX-UPSTREAM from master +Patch3: importlib-metadata.patch +# PATCH-FIX-UPSTREAM from master +Patch4: importlib-py38.patch +# PATCH-FIX-UPSTREAM from master +Patch5: attrs.patch BuildRequires: %{python_module setuptools >= 40.0} BuildRequires: %{python_module setuptools_scm} BuildRequires: fdupes BuildRequires: python-rpm-macros -%if %{with test} -BuildRequires: %{python_module hypothesis} -BuildRequires: %{python_module pytest = %{version}} -BuildRequires: %{python_module setuptools_scm} -BuildRequires: python-funcsigs -BuildRequires: python-mock -BuildRequires: python3-Sphinx -BuildRequires: python3-sphinxcontrib-trio -%endif Requires: python-atomicwrites >= 1.0 Requires: python-attrs >= 17.4.0 +Requires: python-importlib-metadata >= 0.12 Requires: python-more-itertools >= 4.0.0 -Requires: python-pluggy >= 0.7 +Requires: python-packaging +Requires: python-pluggy >= 0.12 Requires: python-py >= 1.5.0 Requires: python-setuptools Requires: python-six >= 1.10.0 Requires(post): update-alternatives Requires(postun): update-alternatives BuildArch: noarch +Conflicts: python-pytest +Provides: python-pytest = %{version}-%{release} +%if %{with test} +BuildRequires: %{python_module hypothesis} +BuildRequires: %{python_module pytest >= %{version}} +BuildRequires: %{python_module setuptools_scm} +BuildRequires: python-funcsigs +BuildRequires: python-mock +%endif %ifpython2 Requires: python-funcsigs %endif @@ -96,10 +106,6 @@ %build %python_build -%if %{with test} -python3 setup.py build_sphinx -rm doc/build/html/.buildinfo -%endif %install %if ! %{with test} @@ -120,7 +126,10 @@ #Check here because in main package creates a buildcycle %check %if %{with test} -%{python_expand py.test-%{$python_bin_suffix}} +# test_installed_plugin_rewrite - changed with new pluggy in the behaviour +# but override works fine, just the tests would need way more adjustments +# test_request_garbage https://bugs.python.org/issue23841 +%pytest -k 'not test_installed_plugin_rewrite and not test_request_garbage' %endif %post @@ -130,10 +139,10 @@ %postun %python_uninstall_alternative py.test +%if ! %{with test} %files %{python_files} %doc AUTHORS CHANGELOG.rst README.rst %license LICENSE -%if ! %{with test} %python_alternative %{_bindir}/py.test %python_alternative %{_bindir}/pytest %python2_only %{_bindir}/py.test2 @@ -141,11 +150,4 @@ %{python_sitelib}/* %endif -%if %{with test} -%files -n python-pytest-doc -%doc CHANGELOG.rst -%doc doc/build/html -%license LICENSE -%endif - %changelog ++++++ attrs.patch ++++++ Index: pytest-3.10.1/src/_pytest/compat.py =================================================================== --- pytest-3.10.1.orig/src/_pytest/compat.py +++ pytest-3.10.1/src/_pytest/compat.py @@ -12,6 +12,7 @@ import re import sys from contextlib import contextmanager +import attr import py import six from six import text_type @@ -447,3 +448,8 @@ if six.PY2: else: from functools import lru_cache # noqa: F401 + +if getattr(attr, "__version_info__", ()) >= (19, 2): + ATTRS_EQ_FIELD = "eq" +else: + ATTRS_EQ_FIELD = "cmp" Index: pytest-3.10.1/src/_pytest/mark/structures.py =================================================================== --- pytest-3.10.1.orig/src/_pytest/mark/structures.py +++ pytest-3.10.1/src/_pytest/mark/structures.py @@ -10,6 +10,7 @@ from six.moves import map from ..compat import getfslineno from ..compat import MappingMixin from ..compat import NOTSET +from ..compat import ATTRS_EQ_FIELD from ..deprecated import MARK_INFO_ATTRIBUTE from ..deprecated import MARK_PARAMETERSET_UNPACKING from _pytest.outcomes import fail @@ -440,7 +441,8 @@ class NodeKeywords(MappingMixin): return "<NodeKeywords for node %s>" % (self.node,) -@attr.s(cmp=False, hash=False) +# mypy cannot find this overload, remove when on attrs>=19.2 +@attr.s(hash=False, **{ATTRS_EQ_FIELD: False}) # type: ignore class NodeMarkers(object): """ internal structure for storing marks belonging to a node ++++++ importlib-metadata.patch ++++++ >From 13f02af97d676bdf7143aa1834c8898fbf753d87 Mon Sep 17 00:00:00 2001 From: Anthony Sottile <asott...@umich.edu> Date: Sat, 6 Apr 2019 17:32:47 -0700 Subject: [PATCH] Switch to importlib-metadata --- changelog/5063.feature.rst | 1 + setup.py | 5 +- src/_pytest/assertion/rewrite.py | 19 ----- src/_pytest/config/__init__.py | 21 ++---- src/_pytest/outcomes.py | 12 +-- testing/acceptance_test.py | 31 +++----- testing/test_assertion.py | 56 +++++--------- testing/test_config.py | 121 ++++++++++++------------------- testing/test_entry_points.py | 14 +--- 9 files changed, 95 insertions(+), 185 deletions(-) create mode 100644 changelog/5063.feature.rst Index: pytest-3.10.1/setup.py =================================================================== --- pytest-3.10.1.orig/setup.py +++ pytest-3.10.1/setup.py @@ -8,20 +8,21 @@ from setuptools import setup INSTALL_REQUIRES = [ "py>=1.5.0", "six>=1.10.0", - "setuptools", + "packaging", "attrs>=17.4.0", "more-itertools>=4.0.0", "atomicwrites>=1.0", 'funcsigs;python_version<"3.0"', 'pathlib2>=2.2.0;python_version<"3.6"', 'colorama;sys_platform=="win32"', + 'importlib-metadata>=0.12', ] # if _PYTEST_SETUP_SKIP_PLUGGY_DEP is set, skip installing pluggy; # used by tox.ini to test with pluggy master if "_PYTEST_SETUP_SKIP_PLUGGY_DEP" not in os.environ: - INSTALL_REQUIRES.append("pluggy>=0.7") + INSTALL_REQUIRES.append("pluggy>=0.12") def main(): Index: pytest-3.10.1/src/_pytest/assertion/rewrite.py =================================================================== --- pytest-3.10.1.orig/src/_pytest/assertion/rewrite.py +++ pytest-3.10.1/src/_pytest/assertion/rewrite.py @@ -60,7 +60,6 @@ class AssertionRewritingHook(object): self.session = None self.modules = {} self._rewritten_names = set() - self._register_with_pkg_resources() self._must_rewrite = set() # flag to guard against trying to rewrite a pyc file while we are already writing another pyc file, # which might result in infinite recursion (#3506) @@ -308,24 +307,6 @@ class AssertionRewritingHook(object): tp = desc[2] return tp == imp.PKG_DIRECTORY - @classmethod - def _register_with_pkg_resources(cls): - """ - Ensure package resources can be loaded from this loader. May be called - multiple times, as the operation is idempotent. - """ - try: - import pkg_resources - - # access an attribute in case a deferred importer is present - pkg_resources.__name__ - except ImportError: - return - - # Since pytest tests are always located in the file system, the - # DefaultProvider is appropriate. - pkg_resources.register_loader_type(cls, pkg_resources.DefaultProvider) - def get_data(self, pathname): """Optional PEP302 get_data API. """ Index: pytest-3.10.1/src/_pytest/config/__init__.py =================================================================== --- pytest-3.10.1.orig/src/_pytest/config/__init__.py +++ pytest-3.10.1/src/_pytest/config/__init__.py @@ -11,10 +11,11 @@ import shlex import sys import types import warnings -from distutils.version import LooseVersion +import importlib_metadata import py import six +from packaging.version import Version from pluggy import HookimplMarker from pluggy import HookspecMarker from pluggy import PluginManager @@ -760,25 +761,17 @@ class Config(object): modules or packages in the distribution package for all pytest plugins. """ - import pkg_resources - self.pluginmanager.rewrite_hook = hook if os.environ.get("PYTEST_DISABLE_PLUGIN_AUTOLOAD"): # We don't autoload from setuptools entry points, no need to continue. return - # 'RECORD' available for plugins installed normally (pip install) - # 'SOURCES.txt' available for plugins installed in dev mode (pip install -e) - # for installed plugins 'SOURCES.txt' returns an empty list, and vice-versa - # so it shouldn't be an issue - metadata_files = "RECORD", "SOURCES.txt" - package_files = ( - entry.split(",")[0] - for entrypoint in pkg_resources.iter_entry_points("pytest11") - for metadata in metadata_files - for entry in entrypoint.dist._get_metadata(metadata) + str(file) + for dist in importlib_metadata.distributions() + if any(ep.group == "pytest11" for ep in dist.entry_points) + for file in dist.files ) for name in _iter_rewritable_modules(package_files): @@ -822,7 +815,7 @@ class Config(object): minver = self.inicfg.get("minversion", None) if minver: - if LooseVersion(minver) > LooseVersion(pytest.__version__): + if Version(minver) > Version(pytest.__version__): raise pytest.UsageError( "%s:%d: requires pytest-%s, actual pytest-%s'" % ( Index: pytest-3.10.1/src/_pytest/outcomes.py =================================================================== --- pytest-3.10.1.orig/src/_pytest/outcomes.py +++ pytest-3.10.1/src/_pytest/outcomes.py @@ -8,6 +8,8 @@ from __future__ import print_function import sys +from packaging.version import Version + class OutcomeException(BaseException): """ OutcomeException and its subclass instances indicate and @@ -165,15 +167,7 @@ def importorskip(modname, minversion=Non return mod verattr = getattr(mod, "__version__", None) if minversion is not None: - try: - from pkg_resources import parse_version as pv - except ImportError: - raise Skipped( - "we have a required version for %r but can not import " - "pkg_resources to parse version strings." % (modname,), - allow_module_level=True, - ) - if verattr is None or pv(verattr) < pv(minversion): + if verattr is None or Version(verattr) < Version(minversion): raise Skipped( "module %r has __version__ %r, required is: %r" % (modname, verattr, minversion), Index: pytest-3.10.1/testing/test_assertion.py =================================================================== --- pytest-3.10.1.orig/testing/test_assertion.py +++ pytest-3.10.1/testing/test_assertion.py @@ -136,12 +136,12 @@ class TestImportHookInstallation(object) def test_pytest_plugins_rewrite_module_names_correctly(self, testdir): """Test that we match files correctly when they are marked for rewriting (#2939).""" contents = { - "conftest.py": """ + "conftest.py": """\ pytest_plugins = "ham" """, "ham.py": "", "hamster.py": "", - "test_foo.py": """ + "test_foo.py": """\ def test_foo(pytestconfig): assert pytestconfig.pluginmanager.rewrite_hook.find_module('ham') is not None assert pytestconfig.pluginmanager.rewrite_hook.find_module('hamster') is None @@ -152,13 +152,13 @@ class TestImportHookInstallation(object) assert result.ret == 0 @pytest.mark.parametrize("mode", ["plain", "rewrite"]) - @pytest.mark.parametrize("plugin_state", ["development", "installed"]) - def test_installed_plugin_rewrite(self, testdir, mode, plugin_state): + def test_installed_plugin_rewrite(self, testdir, mode, monkeypatch): + monkeypatch.delenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD", raising=False) # Make sure the hook is installed early enough so that plugins # installed via setuptools are rewritten. testdir.tmpdir.join("hampkg").ensure(dir=1) contents = { - "hampkg/__init__.py": """ + "hampkg/__init__.py": """\ import pytest @pytest.fixture @@ -167,7 +167,7 @@ class TestImportHookInstallation(object) assert values.pop(0) == value return check """, - "spamplugin.py": """ + "spamplugin.py": """\ import pytest from hampkg import check_first2 @@ -177,46 +177,31 @@ class TestImportHookInstallation(object) assert values.pop(0) == value return check """, - "mainwrapper.py": """ - import pytest, pkg_resources - - plugin_state = "{plugin_state}" - - class DummyDistInfo(object): - project_name = 'spam' - version = '1.0' - - def _get_metadata(self, name): - # 'RECORD' meta-data only available in installed plugins - if name == 'RECORD' and plugin_state == "installed": - return ['spamplugin.py,sha256=abc,123', - 'hampkg/__init__.py,sha256=abc,123'] - # 'SOURCES.txt' meta-data only available for plugins in development mode - elif name == 'SOURCES.txt' and plugin_state == "development": - return ['spamplugin.py', - 'hampkg/__init__.py'] - return [] + "mainwrapper.py": """\ + import pytest, importlib_metadata class DummyEntryPoint(object): name = 'spam' module_name = 'spam.py' - attrs = () - extras = None - dist = DummyDistInfo() + group = 'pytest11' - def load(self, require=True, *args, **kwargs): + def load(self): import spamplugin return spamplugin - def iter_entry_points(group, name=None): - yield DummyEntryPoint() + class DummyDistInfo(object): + version = '1.0' + files = ('spamplugin.py', 'hampkg/__init__.py') + entry_points = (DummyEntryPoint(),) + metadata = {'name': 'foo'} - pkg_resources.iter_entry_points = iter_entry_points + def distributions(): + return (DummyDistInfo(),) + + importlib_metadata.distributions = distributions pytest.main() - """.format( - plugin_state=plugin_state - ), - "test_foo.py": """ + """, + "test_foo.py": """\ def test(check_first): check_first([10, 30], 30) Index: pytest-3.10.1/testing/test_config.py =================================================================== --- pytest-3.10.1.orig/testing/test_config.py +++ pytest-3.10.1/testing/test_config.py @@ -5,6 +5,8 @@ from __future__ import print_function import sys import textwrap +import importlib_metadata + import _pytest._code import pytest from _pytest.config import _iter_rewritable_modules @@ -509,31 +511,25 @@ def test_options_on_small_file_do_not_bl def test_preparse_ordering_with_setuptools(testdir, monkeypatch): - pkg_resources = pytest.importorskip("pkg_resources") - - def my_iter(group, name=None): - assert group == "pytest11" - class Dist(object): - project_name = "spam" - version = "1.0" + class EntryPoint(object): + name = "mytestplugin" + group = "pytest11" - def _get_metadata(self, name): - return ["foo.txt,sha256=abc,123"] + def load(self): + class PseudoPlugin(object): + x = 42 - class EntryPoint(object): - name = "mytestplugin" - dist = Dist() + return PseudoPlugin() - def load(self): - class PseudoPlugin(object): - x = 42 + class Dist(object): + files = () + entry_points = (EntryPoint(),) - return PseudoPlugin() + def my_dists(): + return (Dist,) - return iter([EntryPoint()]) - - monkeypatch.setattr(pkg_resources, "iter_entry_points", my_iter) + monkeypatch.setattr(importlib_metadata, "distributions", my_dists) testdir.makeconftest( """ pytest_plugins = "mytestplugin", @@ -546,58 +542,45 @@ def test_preparse_ordering_with_setuptoo def test_setuptools_importerror_issue1479(testdir, monkeypatch): - pkg_resources = pytest.importorskip("pkg_resources") - - def my_iter(group, name=None): - assert group == "pytest11" - - class Dist(object): - project_name = "spam" - version = "1.0" - - def _get_metadata(self, name): - return ["foo.txt,sha256=abc,123"] - - class EntryPoint(object): - name = "mytestplugin" - dist = Dist() - - def load(self): - raise ImportError("Don't hide me!") + class DummyEntryPoint(object): + name = "mytestplugin" + group = "pytest11" + def load(self): + raise ImportError("Don't hide me!") + + class Distribution(object): + version = "1.0" + files = ("foo.txt",) + entry_points = (DummyEntryPoint(),) - return iter([EntryPoint()]) + def distributions(): + return (Distribution(),) - monkeypatch.setattr(pkg_resources, "iter_entry_points", my_iter) + monkeypatch.setattr(importlib_metadata, "distributions", distributions) with pytest.raises(ImportError): testdir.parseconfig() @pytest.mark.parametrize("block_it", [True, False]) def test_plugin_preparse_prevents_setuptools_loading(testdir, monkeypatch, block_it): - pkg_resources = pytest.importorskip("pkg_resources") - plugin_module_placeholder = object() - def my_iter(group, name=None): - assert group == "pytest11" - - class Dist(object): - project_name = "spam" - version = "1.0" - - def _get_metadata(self, name): - return ["foo.txt,sha256=abc,123"] - - class EntryPoint(object): - name = "mytestplugin" - dist = Dist() + class DummyEntryPoint(object): + name = "mytestplugin" + group = "pytest11" + + def load(self): + return plugin_module_placeholder + + class Distribution(object): + version = "1.0" + files = ("foo.txt",) + entry_points = (DummyEntryPoint(),) - def load(self): - return plugin_module_placeholder + def distributions(): + return (Distribution(),) - return iter([EntryPoint()]) - - monkeypatch.setattr(pkg_resources, "iter_entry_points", my_iter) + monkeypatch.setattr(importlib_metadata, "distributions", distributions) args = ("-p", "no:mytestplugin") if block_it else () config = testdir.parseconfig(*args) config.pluginmanager.import_plugin("mytestplugin") @@ -614,16 +597,21 @@ def test_plugin_preparse_prevents_setupt "parse_args,should_load", [(("-p", "mytestplugin"), True), ((), False)] ) def test_disable_plugin_autoload(testdir, monkeypatch, parse_args, should_load): - pkg_resources = pytest.importorskip("pkg_resources") - - def my_iter(group, name=None): - raise AssertionError("Should not be called") - + class DummyEntryPoint(object): + project_name = name = "mytestplugin" + group = "pytest11" + + class Distribution(object): + entry_points = (DummyEntryPoint(),) + files = () class PseudoPlugin(object): x = 42 + def distributions(): + return (Distribution(),) + monkeypatch.setenv("PYTEST_DISABLE_PLUGIN_AUTOLOAD", "1") - monkeypatch.setattr(pkg_resources, "iter_entry_points", my_iter) + monkeypatch.setattr(importlib_metadata, "distributions", distributions) monkeypatch.setitem(sys.modules, "mytestplugin", PseudoPlugin()) config = testdir.parseconfig(*parse_args) has_loaded = config.pluginmanager.get_plugin("mytestplugin") is not None Index: pytest-3.10.1/testing/test_entry_points.py =================================================================== --- pytest-3.10.1.orig/testing/test_entry_points.py +++ pytest-3.10.1/testing/test_entry_points.py @@ -2,16 +2,10 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import pkg_resources - -import pytest - - -@pytest.mark.parametrize("entrypoint", ["py.test", "pytest"]) -def test_entry_point_exist(entrypoint): - assert entrypoint in pkg_resources.get_entry_map("pytest")["console_scripts"] +import importlib_metadata def test_pytest_entry_points_are_identical(): - entryMap = pkg_resources.get_entry_map("pytest")["console_scripts"] - assert entryMap["pytest"].module_name == entryMap["py.test"].module_name + dist = importlib_metadata.distribution("pytest") + entry_map = {ep.name: ep for ep in dist.entry_points} + assert entry_map["pytest"].value == entry_map["py.test"].value ++++++ importlib-py38.patch ++++++ >From c54cbd63c8bc5db6626d26c0f3339a552a6b1a90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <m...@hroncok.cz> Date: Wed, 3 Jul 2019 01:46:44 +0200 Subject: [PATCH] Replace importlib_metadata with importlib.metadata on Python 3.8+ Fixes https://github.com/pytest-dev/pytest/issues/5537 --- setup.py | 2 +- src/_pytest/compat.py | 6 ++++++ src/_pytest/config/__init__.py | 2 +- testing/acceptance_test.py | 2 +- testing/test_assertion.py | 3 ++- testing/test_config.py | 3 +-- testing/test_entry_points.py | 2 +- 8 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 changelog/5537.bugfix.rst Index: pytest-3.10.1/setup.py =================================================================== --- pytest-3.10.1.orig/setup.py +++ pytest-3.10.1/setup.py @@ -15,7 +15,7 @@ INSTALL_REQUIRES = [ 'funcsigs;python_version<"3.0"', 'pathlib2>=2.2.0;python_version<"3.6"', 'colorama;sys_platform=="win32"', - 'importlib-metadata>=0.12', + 'importlib-metadata>=0.12;python_version<"3.8"', ] Index: pytest-3.10.1/src/_pytest/compat.py =================================================================== --- pytest-3.10.1.orig/src/_pytest/compat.py +++ pytest-3.10.1/src/_pytest/compat.py @@ -60,6 +60,12 @@ else: return None +if sys.version_info >= (3, 8): + from importlib import metadata as importlib_metadata # noqa +else: + import importlib_metadata # noqa + + def _format_args(func): return str(signature(func)) Index: pytest-3.10.1/src/_pytest/config/__init__.py =================================================================== --- pytest-3.10.1.orig/src/_pytest/config/__init__.py +++ pytest-3.10.1/src/_pytest/config/__init__.py @@ -12,7 +12,6 @@ import sys import types import warnings -import importlib_metadata import py import six from packaging.version import Version @@ -31,6 +30,7 @@ from _pytest._code import ExceptionInfo from _pytest._code import filter_traceback from _pytest.compat import lru_cache from _pytest.compat import safe_str +from _pytest.compat import importlib_metadata from _pytest.outcomes import Skipped hookimpl = HookimplMarker("pytest") Index: pytest-3.10.1/testing/acceptance_test.py =================================================================== --- pytest-3.10.1.orig/testing/acceptance_test.py +++ pytest-3.10.1/testing/acceptance_test.py @@ -12,10 +12,10 @@ import py import six import pytest +from _pytest.compat import importlib_metadata from _pytest.main import EXIT_NOTESTSCOLLECTED from _pytest.main import EXIT_USAGEERROR - def prepend_pythonpath(*dirs): cur = os.getenv("PYTHONPATH") if cur: Index: pytest-3.10.1/testing/test_assertion.py =================================================================== --- pytest-3.10.1.orig/testing/test_assertion.py +++ pytest-3.10.1/testing/test_assertion.py @@ -178,7 +178,8 @@ class TestImportHookInstallation(object) return check """, "mainwrapper.py": """\ - import pytest, importlib_metadata + import pytest + from _pytest.compat import importlib_metadata class DummyEntryPoint(object): name = 'spam' Index: pytest-3.10.1/testing/test_config.py =================================================================== --- pytest-3.10.1.orig/testing/test_config.py +++ pytest-3.10.1/testing/test_config.py @@ -5,10 +5,9 @@ from __future__ import print_function import sys import textwrap -import importlib_metadata - import _pytest._code import pytest +from _pytest.compat import importlib_metadata from _pytest.config import _iter_rewritable_modules from _pytest.config.findpaths import determine_setup from _pytest.config.findpaths import get_common_ancestor Index: pytest-3.10.1/testing/test_entry_points.py =================================================================== --- pytest-3.10.1.orig/testing/test_entry_points.py +++ pytest-3.10.1/testing/test_entry_points.py @@ -2,7 +2,7 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function -import importlib_metadata +from _pytest.compat import importlib_metadata def test_pytest_entry_points_are_identical(): ++++++ new-pluggy.patch ++++++ >From a68f4fd2b9e99c82476d0e04ebcf561aeddbcb2e Mon Sep 17 00:00:00 2001 From: Bruno Oliveira <nicodde...@gmail.com> Date: Fri, 22 Feb 2019 18:49:56 -0300 Subject: [PATCH] Fix test failures after pluggy 1.8 release pluggy now calls iter_entry_points with different arguments, and tests which mocked that call need to be updated accordingly. --- testing/test_assertion.py | 2 +- testing/test_config.py | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) Index: pytest-3.10.1/testing/test_assertion.py =================================================================== --- pytest-3.10.1.orig/testing/test_assertion.py +++ pytest-3.10.1/testing/test_assertion.py @@ -208,7 +208,7 @@ class TestImportHookInstallation(object) import spamplugin return spamplugin - def iter_entry_points(name): + def iter_entry_points(group, name=None): yield DummyEntryPoint() pkg_resources.iter_entry_points = iter_entry_points Index: pytest-3.10.1/testing/test_config.py =================================================================== --- pytest-3.10.1.orig/testing/test_config.py +++ pytest-3.10.1/testing/test_config.py @@ -511,8 +511,8 @@ def test_options_on_small_file_do_not_bl def test_preparse_ordering_with_setuptools(testdir, monkeypatch): pkg_resources = pytest.importorskip("pkg_resources") - def my_iter(name): - assert name == "pytest11" + def my_iter(group, name=None): + assert group == "pytest11" class Dist(object): project_name = "spam" @@ -548,8 +548,8 @@ def test_preparse_ordering_with_setuptoo def test_setuptools_importerror_issue1479(testdir, monkeypatch): pkg_resources = pytest.importorskip("pkg_resources") - def my_iter(name): - assert name == "pytest11" + def my_iter(group, name=None): + assert group == "pytest11" class Dist(object): project_name = "spam" @@ -578,8 +578,8 @@ def test_plugin_preparse_prevents_setupt plugin_module_placeholder = object() - def my_iter(name): - assert name == "pytest11" + def my_iter(group, name=None): + assert group == "pytest11" class Dist(object): project_name = "spam" @@ -616,7 +616,7 @@ def test_plugin_preparse_prevents_setupt def test_disable_plugin_autoload(testdir, monkeypatch, parse_args, should_load): pkg_resources = pytest.importorskip("pkg_resources") - def my_iter(name): + def my_iter(group, name=None): raise AssertionError("Should not be called") class PseudoPlugin(object): ++++++ sphinx2.0.patch ++++++ >From 134b957bf42ef92f892ace04651c87ab6d09999f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <m...@hroncok.cz> Date: Thu, 14 Mar 2019 12:15:05 +0100 Subject: [PATCH] Remove deprecated Sphinx directive add_description_unit() Partial solution for https://github.com/pytest-dev/pytest/issues/4912 --- doc/en/conf.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changelog/4912.trivial.rst diff --git a/doc/en/conf.py b/doc/en/conf.py index 74a43596e..5daa15a06 100644 --- a/doc/en/conf.py +++ b/doc/en/conf.py @@ -335,7 +335,7 @@ def setup(app): # from sphinx.ext.autodoc import cut_lines # app.connect('autodoc-process-docstring', cut_lines(4, what=['module'])) - app.add_description_unit( + app.add_object_type( "confval", "confval", objname="configuration value",