Skip to content

Commit

Permalink
Move results path cleanup to pytest_unconfigure
Browse files Browse the repository at this point in the history
  • Loading branch information
dmtucker committed Sep 17, 2024
1 parent c55a9ea commit 97e8f41
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/pytest_mypy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,4 +397,11 @@ def pytest_terminal_summary(
terminalreporter.write_line(results.unmatched_stdout, **color)
if results.stderr:
terminalreporter.write_line(results.stderr, yellow=True)
mypy_results_path.unlink()

def pytest_unconfigure(self, config: pytest.Config) -> None:
"""Clean up the mypy results path."""
try:
config.stash[stash_key["config"]].mypy_results_path.unlink()
except FileNotFoundError: # compat python < 3.8 (missing_ok=True)
# No MypyItems executed.
return

0 comments on commit 97e8f41

Please sign in to comment.