Author: Matti Picus <matti.pi...@gmail.com>
Branch: 
Changeset: r90865:e7aebde27cfc
Date: 2017-03-29 22:25 +0300
http://bitbucket.org/pypy/pypy/changeset/e7aebde27cfc/

Log:    add test for exception ordering on failed import (issue 2524)

diff --git a/pypy/module/imp/test/test_import.py 
b/pypy/module/imp/test/test_import.py
--- a/pypy/module/imp/test/test_import.py
+++ b/pypy/module/imp/test/test_import.py
@@ -361,7 +361,12 @@
         assert sys == o
 
     def test_import_fromlist_must_not_contain_unicodes(self):
-        raises(TypeError, __import__, 'encodings', None, None, [u'xxx'])
+        exc = raises(TypeError, __import__, 'encodings', None, None, [u'xxx'])
+        assert 'not a string' in exc.value.message
+        exc = raises(TypeError, __import__, 'encodings', None, None, [123])
+        assert 'not a string' in exc.value.message
+        # issue 2524
+        raises(ImportError, __import__, 'xxxbadmodule', fromlist=[u'xx']) 
 
     def test_import_relative_back_to_absolute2(self):
         from pkg import abs_x_y
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to