From e3210d07d945bd7b120dd0d6f20036ed664c4129 Mon Sep 17 00:00:00 2001 From: Ilya Priven Date: Tue, 20 Jun 2023 09:41:26 -0400 Subject: [PATCH] meta tests: fix flake (#15480) Since tests are parallelized, the temporary test name must be unique. --- mypy/test/meta/test_parse_data.py | 3 ++- mypy/test/meta/test_update_data.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mypy/test/meta/test_parse_data.py b/mypy/test/meta/test_parse_data.py index a74b3d71d392..cc1b4ff6eeed 100644 --- a/mypy/test/meta/test_parse_data.py +++ b/mypy/test/meta/test_parse_data.py @@ -5,6 +5,7 @@ import subprocess import sys import textwrap +import uuid from pathlib import Path from mypy.test.config import test_data_prefix @@ -18,7 +19,7 @@ def _dedent(self, s: str) -> str: def _run_pytest(self, data_suite: str) -> str: p_test_data = Path(test_data_prefix) p_root = p_test_data.parent.parent - p = p_test_data / "check-__fixture__.test" + p = p_test_data / f"check-meta-{uuid.uuid4()}.test" assert not p.exists() try: p.write_text(data_suite) diff --git a/mypy/test/meta/test_update_data.py b/mypy/test/meta/test_update_data.py index 1239679072e6..67f9a7f56ebd 100644 --- a/mypy/test/meta/test_update_data.py +++ b/mypy/test/meta/test_update_data.py @@ -7,6 +7,7 @@ import subprocess import sys import textwrap +import uuid from pathlib import Path from mypy.test.config import test_data_prefix @@ -21,7 +22,7 @@ def _run_pytest_update_data(self, data_suite: str, *, max_attempts: int) -> str: """ p_test_data = Path(test_data_prefix) p_root = p_test_data.parent.parent - p = p_test_data / "check-__fixture__.test" + p = p_test_data / f"check-meta-{uuid.uuid4()}.test" assert not p.exists() try: p.write_text(textwrap.dedent(data_suite).lstrip())