Accepting request 718087 from devel:languages:python

- Disable tests for now as they break with new pytest-relaxed
- Add another patch fixing errors with new pytest:
  * pytest4.patch

- Restrict pytest5 and pytest4 for now upstream tests only with
  pytest3...

OBS-URL: https://build.opensuse.org/request/show/718087
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-invoke?expand=0&rev=7
This commit is contained in:
Dominique Leuenberger 2019-07-30 11:05:52 +00:00 committed by Git OBS Bridge
commit 9fba789439
3 changed files with 106 additions and 1 deletions

88
pytest4.patch Normal file
View File

@ -0,0 +1,88 @@
From 84f296062a48d30a6c1497e523c21ef3fd9ab534 Mon Sep 17 00:00:00 2001
From: Marcus Crane <marcus@utf9k.net>
Date: Fri, 26 Oct 2018 10:52:19 +1300
Subject: [PATCH 1/3] Updated inspect method
---
invoke/tasks.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/invoke/tasks.py b/invoke/tasks.py
index ed838c31..18cf0afd 100644
--- a/invoke/tasks.py
+++ b/invoke/tasks.py
@@ -151,7 +151,7 @@ def argspec(self, body):
# TODO: __call__ exhibits the 'self' arg; do we manually nix 1st result
# in argspec, or is there a way to get the "really callable" spec?
func = body if isinstance(body, types.FunctionType) else body.__call__
- spec = inspect.getargspec(func)
+ spec = inspect.getfullargspec(func)
arg_names = spec.args[:]
matched_args = [reversed(x) for x in [spec.args, spec.defaults or []]]
spec_dict = dict(zip_longest(*matched_args, fillvalue=NO_DEFAULT))
From db6596d63c76239a91a898ee1557084456e480f7 Mon Sep 17 00:00:00 2001
From: Marcus Crane <marcus@utf9k.net>
Date: Fri, 26 Oct 2018 11:49:41 +1300
Subject: [PATCH 2/3] Update inspect import to be conditional based on 2.7 or 3
---
invoke/tasks.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/invoke/tasks.py b/invoke/tasks.py
index 18cf0afd..cbe106b9 100644
--- a/invoke/tasks.py
+++ b/invoke/tasks.py
@@ -4,7 +4,6 @@
"""
from copy import deepcopy
-import inspect
import types
from .util import six
@@ -14,6 +13,11 @@
else:
from itertools import izip_longest as zip_longest
+try:
+ from inspect import getfullargspec as getargspec
+except AttributeError:
+ from inspect import getargspec
+
from .context import Context
from .parser import Argument, translate_underscores
@@ -151,7 +155,7 @@ def argspec(self, body):
# TODO: __call__ exhibits the 'self' arg; do we manually nix 1st result
# in argspec, or is there a way to get the "really callable" spec?
func = body if isinstance(body, types.FunctionType) else body.__call__
- spec = inspect.getfullargspec(func)
+ spec = getargspec(func)
arg_names = spec.args[:]
matched_args = [reversed(x) for x in [spec.args, spec.defaults or []]]
spec_dict = dict(zip_longest(*matched_args, fillvalue=NO_DEFAULT))
From de3f339f4d699c0a641074ad437802307d0050ba Mon Sep 17 00:00:00 2001
From: Marcus Crane <marcus@utf9k.net>
Date: Fri, 26 Oct 2018 12:10:43 +1300
Subject: [PATCH 3/3] Ooops, checked AttributeError instead of ImportError
---
invoke/tasks.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/invoke/tasks.py b/invoke/tasks.py
index cbe106b9..ad08c893 100644
--- a/invoke/tasks.py
+++ b/invoke/tasks.py
@@ -15,7 +15,7 @@
try:
from inspect import getfullargspec as getargspec
-except AttributeError:
+except ImportError:
from inspect import getargspec
from .context import Context

View File

@ -1,3 +1,16 @@
-------------------------------------------------------------------
Wed Jul 24 07:25:08 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Disable tests for now as they break with new pytest-relaxed
- Add another patch fixing errors with new pytest:
* pytest4.patch
-------------------------------------------------------------------
Fri Jul 19 09:59:13 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Restrict pytest5 and pytest4 for now upstream tests only with
pytest3...
-------------------------------------------------------------------
Tue Mar 26 14:02:06 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>

View File

@ -26,6 +26,7 @@ Group: Development/Languages/Python
URL: http://www.pyinvoke.org
Source: https://files.pythonhosted.org/packages/source/i/invoke/invoke-%{version}.tar.gz
Patch0: 0001-Make-test-fallback-to-system-modules-when-vendorized.patch
Patch1: pytest4.patch
BuildRequires: %{python_module PyYAML}
BuildRequires: %{python_module fluidity-sm}
BuildRequires: %{python_module lexicon}
@ -59,6 +60,7 @@ rm -fr invoke/vendor/*
rm -r invoke/completion/__pycache__/
%patch0 -p1
%patch1 -p1
%build
%python_build
@ -71,7 +73,9 @@ rm -r invoke/completion/__pycache__/
%python_clone -a %{buildroot}%{_bindir}/invoke
%check
%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} py.test-%{$python_bin_suffix}
# broken with new pytest-relaxed (same author), just disable until he
# gets around to release new version
#%%pytest
%post
%{python_install_alternative inv invoke}