- Add patch no-makeitem-method.patch:

* Support pytest > 6.1 
- No longer skip python310.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:pytest/python-pytest-relaxed?expand=0&rev=14
This commit is contained in:
Steve Kowalik 2022-03-10 06:06:44 +00:00 committed by Git OBS Bridge
parent 2a13cf7273
commit b2b7e12aed
3 changed files with 53 additions and 7 deletions

40
no-makeitem-method.patch Normal file
View File

@ -0,0 +1,40 @@
Index: pytest-relaxed-1.1.5/pytest_relaxed/classes.py
===================================================================
--- pytest-relaxed-1.1.5.orig/pytest_relaxed/classes.py
+++ pytest-relaxed-1.1.5/pytest_relaxed/classes.py
@@ -179,23 +179,15 @@ class SpecInstance(RelaxedMixin, Instanc
setattr(obj, name, value)
return obj
- # Stub for pytest >=3.0,<3.3 where _makeitem did not exist
- def makeitem(self, *args, **kwargs):
- return self._makeitem(*args, **kwargs)
-
- def _makeitem(self, name, obj):
- # More pytestmark skipping.
- if name == "pytestmark":
- return
- # NOTE: no need to modify collect() this time, just mutate item
- # creation. TODO: but if collect() is still public, let's move to that
- # sometime, if that'll work as well.
- superb = super(SpecInstance, self)
- attr = "_makeitem" if hasattr(superb, "_makeitem") else "makeitem"
- item = getattr(superb, attr)(name, obj)
- # Replace any Class objects with SpecClass; this will automatically
- # recurse.
- # TODO: can we unify this with SpecModule's same bits?
- if isinstance(item, Class):
- item = SpecClass.from_parent(item.parent, name=item.name)
- return item
+ def collect(self):
+ items = super(SpecInstance, self).collect()
+ collected = []
+ for item in items:
+ # Replace any Class objects with SpecClass, and recurse into it.
+ if isinstance(item, Class):
+ cls = SpecClass.from_parent(item.parent, name=item.name)
+ for item in cls.collect():
+ collected.append(item)
+ else:
+ collected.append(item)
+ return collected

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Mar 10 06:05:48 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch no-makeitem-method.patch:
* Support pytest > 6.1
- No longer skip python310.
-------------------------------------------------------------------
Tue Dec 28 20:34:06 UTC 2021 - Ben Greiner <code@bnavigator.de>

View File

@ -1,7 +1,7 @@
#
# spec file for package python-pytest-relaxed
#
# Copyright (c) 2021 SUSE LLC
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -17,7 +17,6 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python310 1
Name: python-pytest-relaxed
Version: 1.1.5
Release: 0
@ -26,15 +25,16 @@ License: BSD-2-Clause
URL: https://github.com/bitprophet/pytest-relaxed
Source: https://files.pythonhosted.org/packages/source/p/pytest-relaxed/pytest-relaxed-%{version}.tar.gz
Patch0: https://github.com/bitprophet/pytest-relaxed/pull/10.patch#/pytest-relaxed-pr10.patch
# PATCH-FIX-UPSTREAM gh#bitprophet/pytest-relaxed#21
Patch1: no-makeitem-method.patch
BuildRequires: %{python_module decorator >= 4}
# gh#bitprophet/pytest-relaxed#12
BuildRequires: %{python_module pytest < 6.1}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module six}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-decorator >= 4
Requires: python-pytest < 6.1
Requires: python-pytest
Requires: python-six
BuildArch: noarch
%python_subpackages
@ -43,12 +43,11 @@ BuildArch: noarch
Relaxed test discovery/organization plugin for pytest from python-paramiko author
%prep
%setup -q -n pytest-relaxed-%{version}
%autosetup -p1 -n pytest-relaxed-%{version}
# do not hardcode deps
sed -i setup.py \
-e 's:pytest>=3,<5:pytest>=3:' \
-e 's:decorator>=4,<5:decorator>=4:'
%patch0 -p1
%build
export LANG=en_US.UTF-8