Author: Philip Jenvey <[email protected]>
Branch: py3k
Changeset: r65508:c1b28cfd5002
Date: 2013-07-19 20:04 -0700
http://bitbucket.org/pypy/pypy/changeset/c1b28cfd5002/
Log: tweak special casing of lib_pypy imports for py3's appdirect
diff --git a/pypy/module/test_lib_pypy/support.py
b/pypy/module/test_lib_pypy/support.py
--- a/pypy/module/test_lib_pypy/support.py
+++ b/pypy/module/test_lib_pypy/support.py
@@ -9,24 +9,17 @@
Raises a pytest Skip on ImportError if a skip message was specified.
"""
- if option.runappdirect:
- try:
- mod = __import__('lib_pypy.' + name)
- except ImportError as e:
- if skipmsg is not None:
- py.test.skip('%s (%s))' % (skipmsg, str(e)))
- raise
- return getattr(mod, name)
-
try:
# app-level import should find it from the right place (we
# assert so afterwards) as long as a builtin module doesn't
# overshadow it
failed = ("%s didn't import from lib_pypy. Is a usemodules directive "
"overshadowing it?" % name)
- importline = ("(): import %s; assert 'lib_pypy' in %s.__file__, %r; "
+ importline = ("import %s; assert 'lib_pypy' in %s.__file__, %r; "
"return %s" % (name, name, failed, name))
- return space.appexec([], importline)
+ if option.runappdirect:
+ importline = "from lib_pypy " + importline
+ return space.appexec([], "(): " + importline)
except OperationError as e:
if skipmsg is None or not e.match(space, space.w_ImportError):
raise
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit