From 2612d2c0e5de2e8f4adedd25b6658d86e098bed9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Fri, 22 May 2020 12:12:20 +0300 Subject: [PATCH] Make test portable. --- tests/test_pytest_cov.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_pytest_cov.py b/tests/test_pytest_cov.py index eefdc866..ae76924e 100644 --- a/tests/test_pytest_cov.py +++ b/tests/test_pytest_cov.py @@ -553,16 +553,16 @@ def foobar(a, b): script = testdir.makepyfile(''' import os +import tempfile import pytest import mod @pytest.fixture def bad(): - if not os.path.exists('/tmp/crappo'): - os.mkdir('/tmp/crappo') - os.chdir('/tmp/crappo') + path = tempfile.mkdtemp('test_borken_cwd') + os.chdir(path) yield - os.rmdir('/tmp/crappo') + os.rmdir(path) def test_foobar(bad): assert mod.foobar(1, 2) == 3