File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111import tempfile
1212import os
1313import copy
14+ from subprocess import CalledProcessError
1415
1516from future .tests .base import CodeHandler
1617
@@ -202,20 +203,20 @@ def test_itertools_zip_longest(self):
202203 def test_import_from_module (self ):
203204 """
204205 Tests whether e.g. "import socketserver" succeeds in a module
205- imported by another module.
206+ imported by another module. We want this to fail.
206207 """
207208 code1 = '''
208209 from future import standard_library
209210 import importme2
210211 '''
211212 code2 = '''
212213 import socketserver
213- print('Import succeeded! ')
214+ print('Uh oh. importme2 should have raised an ImportError. ')
214215 '''
215216 self ._write_test_script (code1 , 'importme1.py' )
216217 self ._write_test_script (code2 , 'importme2.py' )
217- output = self ._run_test_script ( 'importme1.py' )
218- print ( output )
218+ with self .assertRaises ( CalledProcessError ):
219+ output = self . _run_test_script ( 'importme1.py' )
219220
220221 def test_configparser (self ):
221222 import configparser
You can’t perform that action at this time.
0 commit comments