def test_find_stdlib(tmpdir, monkeypatch): bin_dir = tmpdir.join('bin').ensure(dir=True) pypy = bin_dir.join('pypy').ensure(file=True) build_hierarchy(tmpdir) path, prefix = find_stdlib(None, str(pypy)) assert prefix == tmpdir # in executable is None look for stdlib based on the working directory # see lib-python/2.7/test/test_sys.py:test_executable _, prefix = find_stdlib(None, '') cwd = os.path.dirname(os.path.realpath(__file__)) assert prefix is not None assert cwd.startswith(str(prefix))
def test_find_stdlib(tmpdir): bin_dir = tmpdir.join('bin').ensure(dir=True) pypy = bin_dir.join('pypy').ensure(file=True) build_hierarchy(tmpdir) path, prefix = find_stdlib(None, str(pypy)) assert prefix == tmpdir # in executable is None look for stdlib based on the working directory # see lib-python/2.7/test/test_sys.py:test_executable _, prefix = find_stdlib(None, '') cwd = os.path.dirname(os.path.realpath(__file__)) assert prefix is not None assert cwd.startswith(str(prefix))
def test_find_stdlib_follow_symlink(tmpdir): pypydir = tmpdir.join('opt', 'pypy-xxx') pypy = pypydir.join('bin', 'pypy').ensure(file=True) build_hierarchy(pypydir) pypy_sym = tmpdir.join('pypy_sym') os.symlink(str(pypy), str(pypy_sym)) path, prefix = find_stdlib(None, str(pypy_sym)) assert prefix == pypydir
def test_find_stdlib_follow_symlink(tmpdir): pypydir = tmpdir.join("opt", "pypy-xxx") pypy = pypydir.join("bin", "pypy").ensure(file=True) build_hierarchy(pypydir) pypy_sym = tmpdir.join("pypy_sym") os.symlink(str(pypy), str(pypy_sym)) path, prefix = find_stdlib(None, str(pypy_sym)) assert prefix == pypydir
def test_find_stdlib_follow_pyvenv_cfg(tmpdir): mydir = tmpdir.join('follow_pyvenv_cfg').ensure(dir=True) otherdir = tmpdir.join('otherdir').ensure(dir=True) bin_dir = mydir.join('bin').ensure(dir=True) pypy = bin_dir.join('pypy3').ensure(file=True) build_hierarchy(otherdir) for homedir in [otherdir, otherdir.join('bin')]: mydir.join('pyvenv.cfg').write('home = %s\n' % (homedir, )) _, prefix = find_stdlib(None, str(pypy)) assert prefix == otherdir
def test_find_stdlib(tmpdir): bin_dir = tmpdir.join('bin').ensure(dir=True) pypy = bin_dir.join('pypy').ensure(file=True) build_hierarchy(tmpdir) path, prefix = find_stdlib(None, str(pypy)) assert prefix == tmpdir