Skip to content

Commit

Permalink
Be smarter about temp paths in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jwodder authored and asmacdo committed Jun 10, 2024
1 parent ad77f44 commit 129cc24
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions test/test_execution.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
from pathlib import Path
import shutil
from unittest import mock
import pytest
from utils import assert_files
Expand All @@ -10,9 +9,10 @@


@pytest.fixture
def temp_output_dir(tmp_path):
yield str(tmp_path) + os.sep
shutil.rmtree(tmp_path)
def temp_output_dir(tmp_path: Path) -> str:
# Append path separator so that value is recognized as a directory when
# passed to `output_prefix`
return str(tmp_path) + os.sep


def test_sanity_green(temp_output_dir):
Expand Down
4 changes: 2 additions & 2 deletions test/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ def assert_files(parent_dir, file_list, exists=True):
if exists:
for file_path in file_list:
assert Path(
parent_dir + file_path
parent_dir, file_path
).exists(), f"Expected file does not exist: {file_path}"
else:
for file_path in file_list:
assert not Path(
parent_dir + file_path
parent_dir, file_path
).exists(), f"Unexpected file should not exist: {file_path}"

0 comments on commit 129cc24

Please sign in to comment.