diff -Nru nibabel-3.2.1/debian/changelog nibabel-3.2.1/debian/changelog --- nibabel-3.2.1/debian/changelog 2020-12-19 13:48:49.000000000 +0000 +++ nibabel-3.2.1/debian/changelog 2020-12-21 14:10:02.000000000 +0000 @@ -1,3 +1,11 @@ +nibabel (3.2.1-2) unstable; urgency=medium + + * d/patches + - 983.patch to include https://github.com/nipy/nibabel/pull/983 + addressing failing test due to mocking on older systems + + -- Yaroslav Halchenko Mon, 21 Dec 2020 09:10:02 -0500 + nibabel (3.2.1-1) unstable; urgency=medium * Fresh upstream release diff -Nru nibabel-3.2.1/debian/patches/983.patch nibabel-3.2.1/debian/patches/983.patch --- nibabel-3.2.1/debian/patches/983.patch 1970-01-01 00:00:00.000000000 +0000 +++ nibabel-3.2.1/debian/patches/983.patch 2020-12-21 14:10:02.000000000 +0000 @@ -0,0 +1,41 @@ +From 84c7cf444e0c14fb6706af92e5f96f85c8aadf3d Mon Sep 17 00:00:00 2001 +From: "Christopher J. Markiewicz" +Date: Sun, 20 Dec 2020 12:12:12 -0500 +Origin: https://github.com/nipy/nibabel/pull/983 +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') + diff -Nru nibabel-3.2.1/debian/patches/series nibabel-3.2.1/debian/patches/series --- nibabel-3.2.1/debian/patches/series 2020-12-19 13:48:49.000000000 +0000 +++ nibabel-3.2.1/debian/patches/series 2020-12-21 14:10:02.000000000 +0000 @@ -2,3 +2,4 @@ deb_localmathjax no_doc_sources fix_version_for_sphinx_doc.patch +983.patch