Improve docs so regen doesn't leak temp directories

This commit is contained in:
Anthony Sottile 2019-12-20 13:18:49 -08:00
parent e1df9dbf0d
commit 6cd61390c2
1 changed files with 6 additions and 2 deletions

View File

@ -1035,15 +1035,19 @@ file:
# content of conftest.py # content of conftest.py
import pytest
import tempfile
import os import os
import shutil
import tempfile
import pytest
@pytest.fixture() @pytest.fixture()
def cleandir(): def cleandir():
newpath = tempfile.mkdtemp() newpath = tempfile.mkdtemp()
os.chdir(newpath) os.chdir(newpath)
yield
shutil.rmtree(newpath)
and declare its use in a test module via a ``usefixtures`` marker: and declare its use in a test module via a ``usefixtures`` marker: