pypy/interpreter/test/test_app_main.py::AppTestAppMain::()::test_setup_bootstrap_path
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x0000020615cc4330>
def test_setup_bootstrap_path(self):
# Check how sys.path is handled depending on if we can find a copy of
# the stdlib in setup_bootstrap_path.
import sys, os
old_sys_path = sys.path[:]
old_cwd = os.getcwd()
# make sure cwd does not contain a stdlib
if self.tmp_dir.startswith(self.trunkdir):
skip('TMPDIR is inside the PyPy source')
sys.path.append(self.goal_dir)
tmp_pypy_c = os.path.join(self.tmp_dir, 'pypy3-c')
try:
os.chdir(self.tmp_dir)
# If we are running PyPy with a libpypy3-c, the following
# lines find the stdlib anyway. Otherwise, it is not found.
expected_found = (
getattr(sys, 'pypy_translation_info', {})
.get('translation.shared'))
import app_main
app_main.setup_bootstrap_path(tmp_pypy_c)
if not sys.platform == 'win32':
assert sys.executable == ''
if not expected_found:
assert sys.path == old_sys_path + [self.goal_dir]
app_main.setup_bootstrap_path(self.fake_exe)
if not sys.platform == 'win32':
# an existing file is always 'executable' on windows
assert sys.executable == '' # not executable!
if not expected_found:
assert sys.path == old_sys_path + [self.goal_dir]
os.chmod(self.fake_exe, 0o755)
app_main.setup_bootstrap_path(self.fake_exe)
> assert sys.executable == self.fake_exe
E (application-level) AssertionError
[d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\interpreter\test\test_app_main.py:1319]:38: AssertionError
builder: own-win-x86-64 build #2232
test: pypy/interpreter/test/test_app_main/py/AppTestAppMain/()/test_setup_bootstrap_path