test and fix for apipkg (also available in apipkg default branch)

--HG--
branch : trunk
This commit is contained in:
holger krekel
2010-08-01 20:43:02 +02:00
parent ba1f6336af
commit 8f2b0d0889
3 changed files with 41 additions and 12 deletions

View File

@@ -147,3 +147,19 @@ class TestGeneralUsage:
result = testdir.runpytest()
assert result.ret == 0
assert "should not be seen" not in result.stdout.str()
@py.test.mark.skipif("not hasattr(os, 'symlink')")
def test_chdir(self, testdir):
testdir.tmpdir.join("py").mksymlinkto(py._pydir)
p = testdir.tmpdir.join("main.py")
p.write(py.code.Source("""
import sys, os
sys.path.insert(0, '')
import py
print (py.__file__)
print (py.__path__)
os.chdir(os.path.dirname(os.getcwd()))
print (py.log.Producer)
"""))
result = testdir.runpython(p, prepend=False)
assert not result.ret