Yaroslav Halchenko pushed to branch master at Debian Med / nibabel
Commits: 8c8ecc25 by Yaroslav Halchenko at 2020-12-21T09:10:12-05:00 d/patches - 983.patch to include https://github.com/nipy/nibabel/pull/983 addressing failing test due to mocking on older systems - - - - - 3 changed files: - debian/changelog - + debian/patches/983.patch - debian/patches/series Changes: ===================================== debian/changelog ===================================== @@ -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 <[email protected]> Mon, 21 Dec 2020 09:10:02 -0500 + nibabel (3.2.1-1) unstable; urgency=medium * Fresh upstream release ===================================== debian/patches/983.patch ===================================== @@ -0,0 +1,41 @@ +From 84c7cf444e0c14fb6706af92e5f96f85c8aadf3d Mon Sep 17 00:00:00 2001 +From: "Christopher J. Markiewicz" <[email protected]> +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') + ===================================== debian/patches/series ===================================== @@ -2,3 +2,4 @@ deb_notexext deb_localmathjax no_doc_sources fix_version_for_sphinx_doc.patch +983.patch View it on GitLab: https://salsa.debian.org/med-team/nibabel/-/commit/8c8ecc25c809ed275153b1ba5c0601002bfcf0d2 -- View it on GitLab: https://salsa.debian.org/med-team/nibabel/-/commit/8c8ecc25c809ed275153b1ba5c0601002bfcf0d2 You're receiving this email because of your account on salsa.debian.org.
_______________________________________________ debian-med-commit mailing list [email protected] https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/debian-med-commit
