Philip Jenvey avatar Philip Jenvey committed a401eb4

simplify

Comments (0)

Files changed (1)

pypy/module/test_lib_pypy/support.py

         return getattr(mod, name)
 
     try:
-        # Assume app-level import finds it from the right place (we
-        # assert so afterwards). It should as long as a builtin module
-        # overshadows it
-        w_mod = space.appexec([], "(): import %s; return %s" % (name, name))
+        # 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; "
+                      "return %s" % (name, name, failed, name))
+        return space.appexec([], importline)
     except OperationError as e:
         if skipmsg is None or not e.match(space, space.w_ImportError):
             raise
         py.test.skip('%s (%s))' % (skipmsg, str(e)))
-    w_file = space.getattr(w_mod, space.wrap('__file__'))
-    assert space.is_true(space.contains(w_file, space.wrap('lib_pypy'))), \
-        ("%s didn't import from lib_pypy. Is a usemodules directive "
-         "overshadowing it?" % name)
-    return w_mod
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.