Skip to content

Commit 0b83b40

Browse files
Merge pull request pytest-dev#898 from nicoddemus/tmpdir-factory-new-name
Use pytest-of-$user as base directory for tmpdir_factory
2 parents 9cf9900 + 4302972 commit 0b83b40

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

_pytest/tmpdir.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def getbasetemp(self):
5656
# make_numbered_dir() call
5757
import getpass
5858
temproot = py.path.local.get_temproot()
59-
rootdir = temproot.join('pytest-%s' % getpass.getuser())
59+
rootdir = temproot.join('pytest-of-%s' % getpass.getuser())
6060
rootdir.ensure(dir=1)
6161
basetemp = py.path.local.make_numbered_dir(prefix='pytest-',
6262
rootdir=rootdir)

testing/test_tmpdir.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ def test_1(tmpdir):
9595
result = testdir.runpytest("-s", p, '--basetemp=%s/bt' % linktemp)
9696
assert not result.ret
9797

98+
9899
def test_tmpdir_too_long_on_parametrization(testdir):
99100
testdir.makepyfile("""
100101
import pytest
@@ -104,3 +105,16 @@ def test_some(arg, tmpdir):
104105
""")
105106
reprec = testdir.inline_run()
106107
reprec.assertoutcome(passed=1)
108+
109+
110+
def test_tmpdir_factory(testdir):
111+
testdir.makepyfile("""
112+
import pytest
113+
@pytest.fixture(scope='session')
114+
def session_dir(tmpdir_factory):
115+
return tmpdir_factory.mktemp('data', numbered=False)
116+
def test_some(session_dir):
117+
session_dir.isdir()
118+
""")
119+
reprec = testdir.inline_run()
120+
reprec.assertoutcome(passed=1)

0 commit comments

Comments
 (0)