[pypy-commit] pypy default: don't try to find stdlib if we didn't find an executable, test
bdkearns
noreply at buildbot.pypy.org
Thu Feb 14 19:07:22 CET 2013
Author: Brian Kearns <bdkearns at gmail.com>
Branch:
Changeset: r61240:57305c375b04
Date: 2013-02-14 13:05 -0500
http://bitbucket.org/pypy/pypy/changeset/57305c375b04/
Log: don't try to find stdlib if we didn't find an executable, test
diff --git a/pypy/module/sys/initpath.py b/pypy/module/sys/initpath.py
--- a/pypy/module/sys/initpath.py
+++ b/pypy/module/sys/initpath.py
@@ -67,6 +67,8 @@
stdlib.
If it cannot be found, return (None, None).
"""
+ if executable == '':
+ return None, None
search = executable
while True:
dirname = resolvedirof(search)
diff --git a/pypy/module/sys/test/test_initpath.py b/pypy/module/sys/test/test_initpath.py
--- a/pypy/module/sys/test/test_initpath.py
+++ b/pypy/module/sys/test/test_initpath.py
@@ -10,12 +10,15 @@
b = prefix.join('lib-python', dirname).ensure(dir=1)
return a, b
-def test_find_stdlib(tmpdir):
+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
+ # shouldn't find stdlib if executable == '' even if parent dir has a stdlib
+ monkeypatch.chdir(tmpdir.join('bin'))
+ assert find_stdlib(None, '') == (None, None)
@py.test.mark.skipif('not hasattr(os, "symlink")')
def test_find_stdlib_follow_symlink(tmpdir):
@@ -84,6 +87,7 @@
assert find_executable('pypy') == a.join('pypy.exe')
def test_resolvedirof(tmpdir):
+ assert resolvedirof('') == os.path.abspath(os.path.join(os.getcwd(), '..'))
foo = tmpdir.join('foo').ensure(dir=True)
bar = tmpdir.join('bar').ensure(dir=True)
myfile = foo.join('myfile').ensure(file=True)
More information about the pypy-commit
mailing list