summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_imp.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-04-04 23:48:03 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-04-04 23:48:03 (GMT)
commitfe7c5b5bdf7c21551b56be563fc604f2d4d3c756 (patch)
tree831d9e33e02ad3e1c9bf2d0c113a9de8cdad5770 /Lib/test/test_imp.py
parent7f2fee36401f7b987a368fe043637b3ae7116600 (diff)
downloadcpython-fe7c5b5bdf7c21551b56be563fc604f2d4d3c756.zip
cpython-fe7c5b5bdf7c21551b56be563fc604f2d4d3c756.tar.gz
cpython-fe7c5b5bdf7c21551b56be563fc604f2d4d3c756.tar.bz2
Issue #9319: Include the filename in "Non-UTF8 code ..." syntax error.
Diffstat (limited to 'Lib/test/test_imp.py')
-rw-r--r--Lib/test/test_imp.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_imp.py b/Lib/test/test_imp.py
index 83e17d3..88d2a3e 100644
--- a/Lib/test/test_imp.py
+++ b/Lib/test/test_imp.py
@@ -58,6 +58,12 @@ class ImportTests(unittest.TestCase):
with imp.find_module('module_' + mod, self.test_path)[0] as fd:
self.assertEqual(fd.encoding, encoding)
+ path = [os.path.dirname(__file__)]
+ self.assertRaisesRegex(SyntaxError,
+ r"Non-UTF-8 code starting with '\\xf6'"
+ r" in file .*badsyntax_pep3120.py",
+ imp.find_module, 'badsyntax_pep3120', path)
+
def test_issue1267(self):
for mod, encoding, _ in self.test_strings:
fp, filename, info = imp.find_module('module_' + mod,