1
0

Accepting request 882320 from home:Guillaume_G:branches:openSUSE:Backports:SLE-15-SP3:Staging:adi:32

- Add upstream patch to fix test on Backports:SLE-15-SP3:
  * 983.patch

OBS-URL: https://build.opensuse.org/request/show/882320
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-nibabel?expand=0&rev=15
This commit is contained in:
2021-03-31 14:02:40 +00:00
committed by Git OBS Bridge
parent 8418a16ac1
commit 9516f1eeb7
3 changed files with 48 additions and 0 deletions

39
983.patch Normal file
View 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')

View File

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

View File

@@ -28,6 +28,8 @@ License: MIT
URL: https://nipy.org/nibabel
Source: https://files.pythonhosted.org/packages/source/n/nibabel/nibabel-%{version}.tar.gz
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: %{pythons}
BuildRequires: fdupes
@@ -60,6 +62,7 @@ very limited support for DICOM.
%prep
%setup -q -n nibabel-%{version}
%patch0 -p1
%patch1 -p1
%build
%python_build