Skip to content

Commit 9924432

Browse files
authored
Improve docs so regen doesn't leak temp directories (pytest-dev#6364)
Improve docs so regen doesn't leak temp directories
2 parents c7ac337 + 6cd6139 commit 9924432

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

doc/en/fixture.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,15 +1035,19 @@ file:
10351035
10361036
# content of conftest.py
10371037
1038-
import pytest
1039-
import tempfile
10401038
import os
1039+
import shutil
1040+
import tempfile
1041+
1042+
import pytest
10411043
10421044
10431045
@pytest.fixture()
10441046
def cleandir():
10451047
newpath = tempfile.mkdtemp()
10461048
os.chdir(newpath)
1049+
yield
1050+
shutil.rmtree(newpath)
10471051
10481052
and declare its use in a test module via a ``usefixtures`` marker:
10491053

0 commit comments

Comments
 (0)