Skip to content

Commit 040a61e

Browse files
authored
Merge pull request #6550 from blueyed/doc-cleandir-cd-back
doc/en/fixture.rst: chdir back to previous directory
2 parents 2c32dad + 83451b5 commit 040a61e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

doc/en/fixture.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1042,11 +1042,13 @@ file:
10421042
import pytest
10431043
10441044
1045-
@pytest.fixture()
1045+
@pytest.fixture
10461046
def cleandir():
1047+
old_cwd = os.getcwd()
10471048
newpath = tempfile.mkdtemp()
10481049
os.chdir(newpath)
10491050
yield
1051+
os.chdir(old_cwd)
10501052
shutil.rmtree(newpath)
10511053
10521054
and declare its use in a test module via a ``usefixtures`` marker:

0 commit comments

Comments
 (0)