File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -39,14 +39,14 @@ def test_basic():
3939 # We never have package _not_a_package
4040 assert_bad ('_not_a_package' )
4141
42- # setup_module imports unittest, so make sure we don't disrupt that
42+ # Only disrupt imports for "nottriedbefore" package
4343 orig_import = builtins .__import__
4444 def raise_Exception (* args , ** kwargs ):
45- if args [0 ] == 'unittest ' :
46- return orig_import ( * args , ** kwargs )
47- raise Exception (
48- "non ImportError could be thrown by some malfunctioning module "
49- "upon import, and optional_package should catch it too" )
45+ if args [0 ] == 'nottriedbefore ' :
46+ raise Exception (
47+ "non ImportError could be thrown by some malfunctioning module "
48+ "upon import, and optional_package should catch it too" )
49+ return orig_import ( * args , ** kwargs )
5050 with mock .patch .object (builtins , '__import__' , side_effect = raise_Exception ):
5151 assert_bad ('nottriedbefore' )
5252
You can’t perform that action at this time.
0 commit comments