diff --git a/python-pylama.changes b/python-pylama.changes index 6739102..b77fa7f 100644 --- a/python-pylama.changes +++ b/python-pylama.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Mar 16 04:12:39 UTC 2021 - Steve Kowalik + +- Add support-pytest-6.patch to support running with pytest >= 6. + ------------------------------------------------------------------- Wed Dec 9 10:05:03 UTC 2020 - Benjamin Greiner diff --git a/python-pylama.spec b/python-pylama.spec index 52b0bb6..cd7b999 100644 --- a/python-pylama.spec +++ b/python-pylama.spec @@ -1,7 +1,7 @@ # # spec file for package python-pylama # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -27,6 +27,8 @@ URL: https://github.com/klen/pylama Source: https://files.pythonhosted.org/packages/source/p/pylama/pylama-%{version}.tar.gz # https://github.com/klen/pylama/issues/147 Source1: https://raw.githubusercontent.com/klen/pylama/develop/dummy.py +# PATCH-FIX-UPSTREAM support-pytest-6.patch gh#klen/pylama#189 +Patch0: support-pytest-6.patch BuildRequires: %{python_module eradicate >= 0.2} BuildRequires: %{python_module mccabe >= 0.5.2} BuildRequires: %{python_module pycodestyle >= 2.3.1} @@ -42,7 +44,7 @@ BuildRequires: mypy BuildRequires: python-rpm-macros Requires: python-setuptools Requires(post): update-alternatives -Requires(postun): update-alternatives +Requires(postun):update-alternatives Recommends: mypy Recommends: python-mccabe >= 0.5.2 Recommends: python-pycodestyle >= 2.3.1 @@ -63,6 +65,7 @@ Audit tool for Python and JavaScript. Pylama wraps these tools: %prep %setup -q -n pylama-%{version} cp %{SOURCE1} . +%autopatch -p1 %build export LANG=en_US.UTF-8 diff --git a/support-pytest-6.patch b/support-pytest-6.patch new file mode 100644 index 0000000..c88983b --- /dev/null +++ b/support-pytest-6.patch @@ -0,0 +1,34 @@ +From 84cbc4cabd88f280eecbdaa51b692812be067417 Mon Sep 17 00:00:00 2001 +From: ubaumann +Date: Sun, 2 Aug 2020 18:31:04 +0200 +Subject: [PATCH] Changed to use named constructor 'from_parent' + +Fix for pytest 6.0.0 + +https://docs.pytest.org/en/stable/deprecations.html#node-construction-changed-to-node-from-parent +--- + pylama/pytest.py | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/pylama/pytest.py b/pylama/pytest.py +index e6f6ec1..cb89a69 100644 +--- a/pylama/pytest.py ++++ b/pylama/pytest.py +@@ -40,6 +40,8 @@ def pytest_sessionfinish(session): + def pytest_collect_file(path, parent): + config = parent.config + if config.option.pylama and path.ext == '.py': ++ if hasattr(PylamaItem, "from_parent"): ++ return PylamaItem.from_parent(parent=parent, path=path, fspath=path) + return PylamaItem(path, parent) + + +@@ -49,7 +51,7 @@ class PylamaError(Exception): + + class PylamaItem(pytest.Item, pytest.File): + +- def __init__(self, path, parent): ++ def __init__(self, path, parent, fspath=None): + super(PylamaItem, self).__init__(path, parent) + self.add_marker("pycodestyle") + self.cache = None