forked from pool/python-nibabel
Accepting request 882372 from devel:languages:python:numeric
OBS-URL: https://build.opensuse.org/request/show/882372 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-nibabel?expand=0&rev=8
This commit is contained in:
39
983.patch
Normal file
39
983.patch
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
From 84c7cf444e0c14fb6706af92e5f96f85c8aadf3d Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Christopher J. Markiewicz" <markiewicz@stanford.edu>
|
||||||
|
Date: Sun, 20 Dec 2020 12:12:12 -0500
|
||||||
|
Subject: [PATCH] TEST: Use more constrained mock when testing optpkg
|
||||||
|
|
||||||
|
The existing mock raised errors on any import except a whitelisted
|
||||||
|
unittest. Because pytest monkeypatches the Python interpreter and then
|
||||||
|
performs imports within the patched functions, this breaks in Pytest
|
||||||
|
3.10. Move to an import that blacklists the specific module we're
|
||||||
|
testing.
|
||||||
|
---
|
||||||
|
nibabel/tests/test_optpkg.py | 12 ++++++------
|
||||||
|
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/nibabel/tests/test_optpkg.py b/nibabel/tests/test_optpkg.py
|
||||||
|
index 925180ce6..2bc702210 100644
|
||||||
|
--- a/nibabel/tests/test_optpkg.py
|
||||||
|
+++ b/nibabel/tests/test_optpkg.py
|
||||||
|
@@ -39,14 +39,14 @@ def test_basic():
|
||||||
|
# We never have package _not_a_package
|
||||||
|
assert_bad('_not_a_package')
|
||||||
|
|
||||||
|
- # setup_module imports unittest, so make sure we don't disrupt that
|
||||||
|
+ # Only disrupt imports for "nottriedbefore" package
|
||||||
|
orig_import = builtins.__import__
|
||||||
|
def raise_Exception(*args, **kwargs):
|
||||||
|
- if args[0] == 'unittest':
|
||||||
|
- return orig_import(*args, **kwargs)
|
||||||
|
- raise Exception(
|
||||||
|
- "non ImportError could be thrown by some malfunctioning module "
|
||||||
|
- "upon import, and optional_package should catch it too")
|
||||||
|
+ if args[0] == 'nottriedbefore':
|
||||||
|
+ raise Exception(
|
||||||
|
+ "non ImportError could be thrown by some malfunctioning module "
|
||||||
|
+ "upon import, and optional_package should catch it too")
|
||||||
|
+ return orig_import(*args, **kwargs)
|
||||||
|
with mock.patch.object(builtins, '__import__', side_effect=raise_Exception):
|
||||||
|
assert_bad('nottriedbefore')
|
||||||
|
|
@@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Mar 31 09:09:56 UTC 2021 - Guillaume GARDET <guillaume.gardet@opensuse.org>
|
||||||
|
|
||||||
|
- Add upstream patch to fix test on Backports:SLE-15-SP3:
|
||||||
|
* 983.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Feb 12 14:37:36 UTC 2021 - Dirk Müller <dmueller@suse.com>
|
Fri Feb 12 14:37:36 UTC 2021 - Dirk Müller <dmueller@suse.com>
|
||||||
|
|
||||||
|
@@ -28,6 +28,8 @@ License: MIT
|
|||||||
URL: https://nipy.org/nibabel
|
URL: https://nipy.org/nibabel
|
||||||
Source: https://files.pythonhosted.org/packages/source/n/nibabel/nibabel-%{version}.tar.gz
|
Source: https://files.pythonhosted.org/packages/source/n/nibabel/nibabel-%{version}.tar.gz
|
||||||
Patch0: purge-nose.patch
|
Patch0: purge-nose.patch
|
||||||
|
# PATCH-FIX-UPSTREAM - https://github.com/nipy/nibabel/pull/983
|
||||||
|
Patch1: 983.patch
|
||||||
BuildRequires: %{python_module setuptools >= 30.3.0}
|
BuildRequires: %{python_module setuptools >= 30.3.0}
|
||||||
BuildRequires: %{pythons}
|
BuildRequires: %{pythons}
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
@@ -60,6 +62,7 @@ very limited support for DICOM.
|
|||||||
%prep
|
%prep
|
||||||
%setup -q -n nibabel-%{version}
|
%setup -q -n nibabel-%{version}
|
||||||
%patch0 -p1
|
%patch0 -p1
|
||||||
|
%patch1 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%python_build
|
%python_build
|
||||||
|
Reference in New Issue
Block a user