summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Oliveira <nicoddemus@gmail.com>2019-12-21 13:23:08 -0300
committerGitHub <noreply@github.com>2019-12-21 13:23:08 -0300
commit9924432a2e37d4e4b09be939f5c4162fb898d89f (patch)
treec4540dbd409238c044ed3e7bd1f9d57459965ed5
parentc7ac3379e732bdc065fe23dcd80d5d13fa1f2024 (diff)
parent6cd61390c260055c3637c7a0c08e74a75f31a3cd (diff)
downloadpytest-9924432a2e37d4e4b09be939f5c4162fb898d89f.tar.gz
Improve docs so regen doesn't leak temp directories (#6364)
Improve docs so regen doesn't leak temp directories
-rw-r--r--doc/en/fixture.rst8
1 files changed, 6 insertions, 2 deletions
diff --git a/doc/en/fixture.rst b/doc/en/fixture.rst
index 08305a5cc..db06a4015 100644
--- a/doc/en/fixture.rst
+++ b/doc/en/fixture.rst
@@ -1035,15 +1035,19 @@ file:
# content of conftest.py
- import pytest
- import tempfile
import os
+ import shutil
+ import tempfile
+
+ import pytest
@pytest.fixture()
def cleandir():
newpath = tempfile.mkdtemp()
os.chdir(newpath)
+ yield
+ shutil.rmtree(newpath)
and declare its use in a test module via a ``usefixtures`` marker: