Skip to content

Commit 2612d2c

Browse files
committed
Make test portable.
1 parent fa4bb12 commit 2612d2c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/test_pytest_cov.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -553,16 +553,16 @@ def foobar(a, b):
553553

554554
script = testdir.makepyfile('''
555555
import os
556+
import tempfile
556557
import pytest
557558
import mod
558559
559560
@pytest.fixture
560561
def bad():
561-
if not os.path.exists('/tmp/crappo'):
562-
os.mkdir('/tmp/crappo')
563-
os.chdir('/tmp/crappo')
562+
path = tempfile.mkdtemp('test_borken_cwd')
563+
os.chdir(path)
564564
yield
565-
os.rmdir('/tmp/crappo')
565+
os.rmdir(path)
566566
567567
def test_foobar(bad):
568568
assert mod.foobar(1, 2) == 3

0 commit comments

Comments
 (0)