diff --git a/_pytest/__init__.py b/_pytest/__init__.py index b8d360007..d2dc3e496 100644 --- a/_pytest/__init__.py +++ b/_pytest/__init__.py @@ -1,2 +1,2 @@ # -__version__ = '2.1.4.dev1' +__version__ = '2.1.4.dev2' diff --git a/_pytest/tmpdir.py b/_pytest/tmpdir.py index e46c713eb..c67f4389e 100644 --- a/_pytest/tmpdir.py +++ b/_pytest/tmpdir.py @@ -46,7 +46,7 @@ class TempdirHandler: def finish(self): self.trace("finish") - + def pytest_configure(config): mp = monkeypatch() t = TempdirHandler(config) @@ -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 diff --git a/setup.py b/setup.py index e2eaad50b..22e0a07e1 100644 --- a/setup.py +++ b/setup.py @@ -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'], diff --git a/testing/test_tmpdir.py b/testing/test_tmpdir.py index 0f5ec1521..79eb9e836 100644 --- a/testing/test_tmpdir.py +++ b/testing/test_tmpdir.py @@ -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