File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -39,9 +39,7 @@ class AppIdentityError(Exception):
39
39
40
40
41
41
try :
42
- _ , _package_dir , _ = imp .find_module ('OpenSSL' )
43
- if not os .path .isfile (os .path .join (_package_dir , 'crypto.py' )):
44
- raise ImportError ('No module named OpenSSL' )
42
+ _ = imp .find_module ('OpenSSL' )
45
43
46
44
class OpenSSLVerifier (object ):
47
45
"""Verifies the signature on a message."""
Original file line number Diff line number Diff line change @@ -58,15 +58,17 @@ def test_succeeds(self):
58
58
self .assertTrue (pem_contents in [pkcs12_key_as_pem , alternate_pem ])
59
59
60
60
def test_without_openssl (self ):
61
- import os
62
- path_isfile = os .path .isfile
61
+ import imp
62
+ imp_find_module = imp .find_module
63
+ def find_module (module_name ):
64
+ raise ImportError ('No module named %s' % module_name )
63
65
try :
64
- os . path . isfile = lambda value : False
66
+ imp . find_module = find_module
65
67
reload (crypt )
66
68
self .assertRaises (NotImplementedError , crypt .pkcs12_key_as_pem ,
67
69
'FOO' , 'BAR' )
68
70
finally :
69
- os . path . isfile = path_isfile
71
+ imp . find_module = imp_find_module
70
72
reload (crypt )
71
73
72
74
def test_with_nonsense_key (self ):
You can’t perform that action at this time.
0 commit comments