14
0
forked from pool/python-wrapt

Accepting request 853000 from home:bnavigator:branches:devel:languages:python

- Fix python3.6 build with pytest 6
  * fix-dummy-collector-pytest6.patch
  * gh#GrahamDumpleton/wrapt#168

OBS-URL: https://build.opensuse.org/request/show/853000
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-wrapt?expand=0&rev=23
This commit is contained in:
2020-12-04 10:49:15 +00:00
committed by Git OBS Bridge
parent 6ab6e1f8b1
commit 39009f250a
3 changed files with 59 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
From abb18d6f52a0fd22de209f5d02f4d5c66656a26a Mon Sep 17 00:00:00 2001
From: Ben Greiner <code@bnavigator.de>
Date: Fri, 4 Dec 2020 01:24:34 +0100
Subject: [PATCH] fix dummycollector for pytest >= 6
---
tests/conftest.py | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/tests/conftest.py b/tests/conftest.py
index e37790f..9e9e35b 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -2,18 +2,30 @@
import pytest
+try:
+ from pytest import File as FileCollector
+except ImportError:
+ from pytest.collect import File as FileCollector
+
version = tuple(sys.version_info[:2])
-class DummyCollector(pytest.collect.File):
+class DummyCollector(FileCollector):
def collect(self):
return []
+def construct_dummy(path, parent):
+ if hasattr(DummyCollector, "from_parent"):
+ item = DummyCollector.from_parent(parent, fspath=path)
+ return item
+ else:
+ return DummyCollector(path, parent=parent)
+
def pytest_pycollect_makemodule(path, parent):
if '_py33' in path.basename and version < (3, 3):
- return DummyCollector(path, parent=parent)
+ return construct_dummy(path, parent)
if '_py37' in path.basename and version < (3, 7):
- return DummyCollector(path, parent=parent)
+ return construct_dummy(path, parent)
if '_py3' in path.basename and version < (3, 0):
- return DummyCollector(path, parent=parent)
+ return construct_dummy(path, parent)
if '_py2' in path.basename and version >= (3, 0):
- return DummyCollector(path, parent=parent)
+ return construct_dummy(path, parent)

View File

@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Dec 4 00:37:53 UTC 2020 - Benjamin Greiner <code@bnavigator.de>
- Fix python3.6 build with pytest 6
* fix-dummy-collector-pytest6.patch
* gh#GrahamDumpleton/wrapt#168
-------------------------------------------------------------------
Mon Mar 16 11:01:55 UTC 2020 - Dirk Mueller <dmueller@suse.com>

View File

@@ -26,6 +26,8 @@ License: BSD-2-Clause
Group: Development/Languages/Python
URL: https://github.com/GrahamDumpleton/wrapt
Source: https://github.com/GrahamDumpleton/wrapt/archive/%{version}.tar.gz
# PATCH-FIX-UPSTREAM gh#GrahamDumpleton/wrapt#168 -- fix pytest 6 dummy collection
Patch0: https://github.com/GrahamDumpleton/wrapt/pull/168.patch#/fix-dummy-collector-pytest6.patch
BuildRequires: %{python_module devel}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
@@ -59,6 +61,7 @@ For further information on the **wrapt** module see:
%prep
%setup -q -n wrapt-%{version}
%patch0 -p1
%build
export CFLAGS="%{optflags}"