don't remove symlinks from temporary directory path - should help with some standard OSX setups

This commit is contained in:
holger krekel 2011-11-06 19:34:02 +00:00
parent d4fe273b2f
commit 077c468589
4 changed files with 17 additions and 4 deletions

View File

@ -1,2 +1,2 @@
#
__version__ = '2.1.4.dev1'
__version__ = '2.1.4.dev2'

View File

@ -64,5 +64,5 @@ def pytest_funcarg__tmpdir(request):
name = request._pyfuncitem.name
name = py.std.re.sub("[\W]", "_", name)
x = request.config._tmpdirhandler.mktemp(name, numbered=True)
return x.realpath()
return x

View File

@ -24,7 +24,7 @@ def main():
name='pytest',
description='py.test: simple powerful testing with Python',
long_description = long_description,
version='2.1.4.dev1',
version='2.1.4.dev2',
url='http://pytest.org',
license='MIT license',
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],

View File

@ -75,3 +75,16 @@ def test_basetemp(testdir):
result = testdir.runpytest(p, '--basetemp=%s' % mytemp)
assert result.ret == 0
assert mytemp.join('hello').check()
@pytest.mark.skipif("not hasattr(os, 'symlink')")
def test_tmpdir_keeps_symlinks(testdir):
realtemp = testdir.tmpdir.mkdir("myrealtemp")
linktemp = testdir.tmpdir.join("symlinktemp")
linktemp.mksymlinkto(realtemp)
p = testdir.makepyfile("""
def test_1(tmpdir):
import os
assert os.path.realpath(str(tmpdir)) != str(tmpdir)
""")
result = testdir.runpytest("-s", p, '--basetemp=%s/bt' % linktemp)
assert not result.ret