Skip to content

Commit da22975

Browse files
committed
Fix imports in test_standard_library
1 parent e52b58e commit da22975

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

future/tests/test_standard_library.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import tempfile
1212
import os
1313
import copy
14+
from subprocess import CalledProcessError
1415

1516
from 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

0 commit comments

Comments
 (0)