Author: Antonio Cuni <[email protected]>
Branch: py3k
Changeset: r52933:50dddd4ecf08
Date: 2012-02-27 14:16 +0100
http://bitbucket.org/pypy/pypy/changeset/50dddd4ecf08/
Log: pff, yak shaving. Since we are now passing an explicit globals() for
exec(), the __name__ was not set. This caused the imp module to be
confused, and the test to fail. It took 2 hours to track it down
:-(
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
@@ -422,17 +422,18 @@
assert pkg.pkg1.__package__ == 'pkg.pkg1'
def test_future_relative_import_error_when_in_non_package(self):
- ns = {}
+ ns = {'__name__': __name__}
exec("""def imp():
+ print('__name__ =', __name__)
from .string import inpackage
- """.rstrip(), ns)
+ """, ns)
raises(ValueError, ns['imp'])
def test_future_relative_import_error_when_in_non_package2(self):
- ns = {}
+ ns = {'__name__': __name__}
exec("""def imp():
from .. import inpackage
- """.rstrip(), ns)
+ """, ns)
raises(ValueError, ns['imp'])
def test_relative_import_with___name__(self):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit