Improve docs so regen doesn't leak temp directories (#6364)
Improve docs so regen doesn't leak temp directories
This commit is contained in:
commit
9924432a2e
|
@ -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:
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue