Skip to content

Commit

Permalink
Add doctest for temp_dir. Increases coverage from 71% to 74%.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Jan 19, 2023
1 parent 7e22446 commit 04dc137
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions jaraco/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ def temp_dir(remover=shutil.rmtree):
"""
Create a temporary directory context. Pass a custom remover
to override the removal behavior.
>>> import pathlib
>>> with temp_dir() as the_dir:
... assert os.path.isdir(the_dir)
... _ = pathlib.Path(the_dir).joinpath('somefile').write_text('contents')
>>> assert not os.path.exists(the_dir)
"""
temp_dir = tempfile.mkdtemp()
try:
Expand Down

0 comments on commit 04dc137

Please sign in to comment.