Skip to content

Commit

Permalink
meta tests: fix flake (#15480)
Browse files Browse the repository at this point in the history
Since tests are parallelized, the temporary test name must be unique.
  • Loading branch information
ikonst committed Jun 20, 2023
1 parent 1e5caa0 commit e3210d0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion mypy/test/meta/test_parse_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import subprocess
import sys
import textwrap
import uuid
from pathlib import Path

from mypy.test.config import test_data_prefix
Expand All @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion mypy/test/meta/test_update_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import subprocess
import sys
import textwrap
import uuid
from pathlib import Path

from mypy.test.config import test_data_prefix
Expand All @@ -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())
Expand Down

0 comments on commit e3210d0

Please sign in to comment.