Commits

Philip Jenvey  committed fd721a7

add the pypyroot to the appdirect sys.path so it can import from lib_pypy

  • Participants
  • Parent commits fcb802e
  • Branches py3k

Comments (0)

Files changed (1)

File pypy/tool/pytest/apptest.py

 # ...unless the -A option ('runappdirect') is passed.
 
 import py
+import os
 import sys, textwrap, types
 from pypy.interpreter.gateway import app2interp_temp
 from pypy.interpreter.error import OperationError
 from pypy.tool.pytest import appsupport
 from pypy.tool.pytest.objspace import gettestobjspace
 from rpython.tool.udir import udir
-from pypy.conftest import PyPyClassCollector
+from pypy.conftest import PyPyClassCollector, pypydir
 from inspect import getmro
 
+pypyroot = os.path.dirname(pypydir)
+
 RENAMED_USEMODULES = dict(
     _winreg='winreg',
     exceptions='builtins',
     helpers = r"""# -*- encoding: utf-8 -*-
 if 1:
     import sys
+    sys.path.append('%s')
 %s
     def skip(message):
         print(message)
     else:
         target_name = target_.__name__
     with pyfile.open('w') as f:
-        f.write(helpers % check_usemodules)
+        f.write(helpers % (pypyroot, check_usemodules))
         f.write('\n'.join(defs))
         f.write('def %s():\n' % target_name)
         f.write('\n'.join(source))