From f78525e2d31e471146993c38aa08db560777dcff Mon Sep 17 00:00:00 2001 From: Thibaut Decombe Date: Mon, 13 Apr 2026 19:10:58 +0200 Subject: [PATCH] Include test case name in temp directory prefix This helps with debugging (identifying which test owns which temp dir) and avoids potential mypy cache contamination when multiple tests use the same module names. --- pytest_mypy_plugins/item.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytest_mypy_plugins/item.py b/pytest_mypy_plugins/item.py index 957d4fa..8f5c4cc 100644 --- a/pytest_mypy_plugins/item.py +++ b/pytest_mypy_plugins/item.py @@ -394,7 +394,7 @@ def execute_extension_hook(self) -> None: def runtest(self) -> None: try: - temp_dir = tempfile.TemporaryDirectory(prefix="pytest-mypy-", dir=self.root_directory) + temp_dir = tempfile.TemporaryDirectory(prefix=f"pytest-mypy-{self.name}-", dir=self.root_directory) except (FileNotFoundError, PermissionError, NotADirectoryError) as e: raise TypecheckAssertionError(