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():
39
39
# We never have package _not_a_package
40
40
assert_bad ('_not_a_package' )
41
41
42
- # setup_module imports unittest, so make sure we don't disrupt that
42
+ # Only disrupt imports for "nottriedbefore" package
43
43
orig_import = builtins .__import__
44
44
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 )
50
50
with mock .patch .object (builtins , '__import__' , side_effect = raise_Exception ):
51
51
assert_bad ('nottriedbefore' )
52
52
You can’t perform that action at this time.
0 commit comments