Merge pull request #898 from nicoddemus/tmpdir-factory-new-name

Use pytest-of-$user as base directory for tmpdir_factory
This commit is contained in:
Ronny Pfannschmidt 2015-07-29 13:58:42 +02:00
commit 0b83b4076a
2 changed files with 15 additions and 1 deletions

View File

@ -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)

View File

@ -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)