14
0
forked from pool/python-pylama

- Add support-pytest-6.patch to support running with pytest >= 6.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pylama?expand=0&rev=13
This commit is contained in:
2021-03-16 04:13:25 +00:00
committed by Git OBS Bridge
parent c0b33fda4d
commit 3ec42500b1
3 changed files with 44 additions and 2 deletions

View File

@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Tue Mar 16 04:12:39 UTC 2021 - Steve Kowalik <steven.kowalik@suse.com>
- Add support-pytest-6.patch to support running with pytest >= 6.
-------------------------------------------------------------------
Wed Dec 9 10:05:03 UTC 2020 - Benjamin Greiner <code@bnavigator.de>

View File

@@ -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

34
support-pytest-6.patch Normal file
View File

@@ -0,0 +1,34 @@
From 84cbc4cabd88f280eecbdaa51b692812be067417 Mon Sep 17 00:00:00 2001
From: ubaumann <github@m.ubaumann.ch>
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