Skip to content

Commit 8118ef6

Browse files
committed
conformance - subprocess.run to use utf-8 to avoid issues on Windows
It was previously failing only for pyright but added it for all type checkers just to be sure. ``` Traceback (most recent call last): File "L:\Projects\Github\typing\conformance\src\main.py", line 260, in <module> main() File "L:\Projects\Github\typing\conformance\src\main.py", line 253, in main run_tests(root_dir, type_checker, test_cases, skip_timing=options.skip_timing) File "L:\Projects\Github\typing\conformance\src\main.py", line 34, in run_tests type_checker.parse_errors(output.splitlines()) File "L:\Projects\Github\typing\conformance\src\type_checker.py", line 206, in parse_errors assert line.count(":") >= 3, f"Failed to parse line: {line!r}" ^^^^^^^^^^^^^^^^^^^^ AssertionError: Failed to parse line: 'Â\xa0Â\xa0Use list[T] to indicate a list type or T1 | T2 to indicate a union type (reportInvalidTypeForm)' ``` Update type_checker.py
1 parent dde9ec4 commit 8118ef6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

conformance/src/type_checker.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def run_tests(self, test_files: Sequence[str]) -> dict[str, str]:
114114
"--enable-error-code",
115115
"deprecated",
116116
]
117-
proc = run(command, stdout=PIPE, text=True)
117+
proc = run(command, stdout=PIPE, text=True, encoding="utf-8")
118118
lines = proc.stdout.split("\n")
119119

120120
# Add results to a dictionary keyed by the file name.
@@ -174,7 +174,7 @@ def get_version(self) -> str:
174174

175175
def run_tests(self, test_files: Sequence[str]) -> dict[str, str]:
176176
command = [sys.executable, "-m", "pyright", ".", "--outputjson"]
177-
proc = run(command, stdout=PIPE, text=True)
177+
proc = run(command, stdout=PIPE, text=True, encoding="utf-8")
178178
output_json = json.loads(proc.stdout)
179179
diagnostics = output_json["generalDiagnostics"]
180180

@@ -253,7 +253,7 @@ def get_version(self) -> str:
253253
return version
254254

255255
def run_tests(self, test_files: Sequence[str]) -> dict[str, str]:
256-
proc = run(["pyre", "check"], stdout=PIPE, text=True)
256+
proc = run(["pyre", "check"], stdout=PIPE, text=True, encoding="utf-8")
257257
lines = proc.stdout.split("\n")
258258

259259
# Add results to a dictionary keyed by the file name.

0 commit comments

Comments
 (0)