diff options
author | Bruno Oliveira <nicoddemus@gmail.com> | 2019-12-21 13:23:08 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-21 13:23:08 -0300 |
commit | 9924432a2e37d4e4b09be939f5c4162fb898d89f (patch) | |
tree | c4540dbd409238c044ed3e7bd1f9d57459965ed5 | |
parent | c7ac3379e732bdc065fe23dcd80d5d13fa1f2024 (diff) | |
parent | 6cd61390c260055c3637c7a0c08e74a75f31a3cd (diff) | |
download | pytest-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.rst | 8 |
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: |