Skip to content

Commit 97e8f41

Browse files
committed
Move results path cleanup to pytest_unconfigure
1 parent c55a9ea commit 97e8f41

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/pytest_mypy/__init__.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -397,4 +397,11 @@ def pytest_terminal_summary(
397397
terminalreporter.write_line(results.unmatched_stdout, **color)
398398
if results.stderr:
399399
terminalreporter.write_line(results.stderr, yellow=True)
400-
mypy_results_path.unlink()
400+
401+
def pytest_unconfigure(self, config: pytest.Config) -> None:
402+
"""Clean up the mypy results path."""
403+
try:
404+
config.stash[stash_key["config"]].mypy_results_path.unlink()
405+
except FileNotFoundError: # compat python < 3.8 (missing_ok=True)
406+
# No MypyItems executed.
407+
return

0 commit comments

Comments
 (0)