Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testupdatedata: fix cwd #15383

Merged
merged 1 commit into from
Jun 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions mypy/test/testupdatedata.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ def _run_pytest_update_data(self, data_suite: str, *, max_attempts: int) -> str:
Runs a suite of data test cases through 'pytest --update-data' until either tests pass
or until a maximum number of attempts (needed for incremental tests).
"""
p = Path(test_data_prefix) / "check-update-data.test"
p_test_data = Path(test_data_prefix)
p_root = p_test_data.parent.parent
p = p_test_data / "check-update-data.test"
assert not p.exists()
try:
p.write_text(textwrap.dedent(data_suite).lstrip())
Expand All @@ -26,7 +28,7 @@ def _run_pytest_update_data(self, data_suite: str, *, max_attempts: int) -> str:
else:
cmd = " ".join(args)
for i in range(max_attempts - 1, -1, -1):
res = subprocess.run(args)
res = subprocess.run(args, cwd=p_root)
if res.returncode == 0:
break
print(f"`{cmd}` returned {res.returncode}: {i} attempts remaining")
Expand Down