diff --git a/_pytest/tmpdir.py b/_pytest/tmpdir.py index 9f9c4da6b..44e980e2e 100644 --- a/_pytest/tmpdir.py +++ b/_pytest/tmpdir.py @@ -56,7 +56,7 @@ class TempdirFactory: # make_numbered_dir() call import getpass temproot = py.path.local.get_temproot() - rootdir = temproot.join('pytest-%s' % getpass.getuser()) + rootdir = temproot.join('pytest-of-%s' % getpass.getuser()) rootdir.ensure(dir=1) basetemp = py.path.local.make_numbered_dir(prefix='pytest-', rootdir=rootdir) diff --git a/testing/test_tmpdir.py b/testing/test_tmpdir.py index 7c2095e6e..05b24fc59 100644 --- a/testing/test_tmpdir.py +++ b/testing/test_tmpdir.py @@ -95,6 +95,7 @@ def test_tmpdir_always_is_realpath(testdir): result = testdir.runpytest("-s", p, '--basetemp=%s/bt' % linktemp) assert not result.ret + def test_tmpdir_too_long_on_parametrization(testdir): testdir.makepyfile(""" import pytest @@ -104,3 +105,16 @@ def test_tmpdir_too_long_on_parametrization(testdir): """) reprec = testdir.inline_run() reprec.assertoutcome(passed=1) + + +def test_tmpdir_factory(testdir): + testdir.makepyfile(""" + import pytest + @pytest.fixture(scope='session') + def session_dir(tmpdir_factory): + return tmpdir_factory.mktemp('data', numbered=False) + def test_some(session_dir): + session_dir.isdir() + """) + reprec = testdir.inline_run() + reprec.assertoutcome(passed=1) \ No newline at end of file