Apply suggestions from code review of branch Windows-Testing
Co-authored-by: Richard Bowman <richard.bowman@cantab.net>
This commit is contained in:
parent
d6b00ef1bb
commit
a15458c02d
1 changed files with 3 additions and 5 deletions
|
|
@ -59,15 +59,13 @@ def _git(command: str) -> str:
|
|||
def temp_dir():
|
||||
"""Return the path of a temporary directory (set as working dir)."""
|
||||
working_dir = os.getcwd()
|
||||
try:
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
try:
|
||||
os.chdir(tmpdir)
|
||||
yield tmpdir
|
||||
finally:
|
||||
# Change back to working dir before closing context manager or Windows will error
|
||||
os.chdir(working_dir)
|
||||
finally:
|
||||
# Ensure changed to working dir
|
||||
os.chdir(working_dir)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue