コード例 #1
0
 def test_trunk_can_be_prefix(self):
     import sys
     import os
     old_sys_path = sys.path[:]
     sys.path.append(self.goal_dir)
     try:
         import app_main
         pypy_c = os.path.join(self.trunkdir, 'pypy', 'translator', 'goal', 'pypy-c')
         app_main.setup_bootstrap_path(pypy_c)
         newpath = sys.path[:]
         # we get at least lib_pypy 
         # lib-python/X.Y.Z, and maybe more (e.g. plat-linux2)
         assert len(newpath) >= 2
         for p in newpath:
             assert p.startswith(self.trunkdir)
     finally:
         sys.path[:] = old_sys_path
コード例 #2
0
 def test_setup_bootstrap_path(self):
     import sys
     import os
     old_sys_path = sys.path[:]
     sys.path.append(self.goal_dir)
     try:
         import app_main
         app_main.setup_bootstrap_path('/tmp/pypy-c') # stdlib not found
         sys.path == old_sys_path
         assert sys.executable == ''
         #
         app_main.setup_bootstrap_path(self.fake_exe)
         assert sys.executable == self.fake_exe
         newpath = sys.path[:]
         if newpath[0].endswith('__extensions__'):
             newpath = newpath[1:]
         # we get at least 'expected_path', and maybe more (e.g.plat-linux2)
         assert newpath[:len(self.expected_path)] == self.expected_path
     finally:
         sys.path[:] = old_sys_path