From dbcfed0e7b3fe86ff36db725c5cc7e5dc15e42ac Mon Sep 17 00:00:00 2001 From: Ilya Priven Date: Mon, 12 Jun 2023 06:41:19 -0400 Subject: [PATCH] test_parse_data: fix cwd --- mypy/test/meta/test_parse_data.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mypy/test/meta/test_parse_data.py b/mypy/test/meta/test_parse_data.py index 6d9b32b96c7e..a74b3d71d392 100644 --- a/mypy/test/meta/test_parse_data.py +++ b/mypy/test/meta/test_parse_data.py @@ -16,13 +16,15 @@ def _dedent(self, s: str) -> str: return textwrap.dedent(s).lstrip() def _run_pytest(self, data_suite: str) -> str: - p = Path(test_data_prefix) / "check-__fixture__.test" + p_test_data = Path(test_data_prefix) + p_root = p_test_data.parent.parent + p = p_test_data / "check-__fixture__.test" assert not p.exists() try: p.write_text(data_suite) test_nodeid = f"mypy/test/testcheck.py::TypeCheckSuite::{p.name}" args = [sys.executable, "-m", "pytest", "-n", "0", "-s", test_nodeid] - proc = subprocess.run(args, capture_output=True, check=False) + proc = subprocess.run(args, cwd=p_root, capture_output=True, check=False) return proc.stdout.decode() finally: p.unlink()