Skip to content

Commit 54b6ce2

Browse files
authored
Conformance: fix issues running on Windows (#1969)
1 parent dde9ec4 commit 54b6ce2

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

Diff for: conformance/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ To run the conformance test suite:
6060
* Switch to the `conformance` subdirectory and install all dependencies (`pip install -r requirements.txt`).
6161
* Switch to the `src` subdirectory and run `python main.py`.
6262

63-
Note that some type checkers may not run on some platforms. For example, pytype cannot be installed on Windows. If a type checker fails to install, tests will be skipped for that type checker.
63+
Note that some type checkers may not run on some platforms. If a type checker fails to install, tests will be skipped for that type checker.
6464

6565
## Reporting Conformance Results
6666

Diff for: conformance/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ pyright
55
mypy
66
pip
77
pyre-check
8-
pytype; platform_system != "Windows"
8+
pytype

Diff for: conformance/src/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def f(): pass # E[final]
6767
{"final": [3, 4]}
6868
)
6969
"""
70-
with open(test_case, "r") as f:
70+
with open(test_case, "r", encoding="utf-8") as f:
7171
lines = f.readlines()
7272
output: dict[int, tuple[int, int]] = {}
7373
groups: dict[str, list[int]] = {}

Diff for: conformance/src/type_checker.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"""
44

55
from abc import ABC, abstractmethod
6-
from curses.ascii import isspace
76
import json
87
from pathlib import Path
98
import os
@@ -114,7 +113,7 @@ def run_tests(self, test_files: Sequence[str]) -> dict[str, str]:
114113
"--enable-error-code",
115114
"deprecated",
116115
]
117-
proc = run(command, stdout=PIPE, text=True)
116+
proc = run(command, stdout=PIPE, text=True, encoding="utf-8")
118117
lines = proc.stdout.split("\n")
119118

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

175174
def run_tests(self, test_files: Sequence[str]) -> dict[str, str]:
176175
command = [sys.executable, "-m", "pyright", ".", "--outputjson"]
177-
proc = run(command, stdout=PIPE, text=True)
176+
proc = run(command, stdout=PIPE, text=True, encoding="utf-8")
178177
output_json = json.loads(proc.stdout)
179178
diagnostics = output_json["generalDiagnostics"]
180179

@@ -253,7 +252,7 @@ def get_version(self) -> str:
253252
return version
254253

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

259258
# Add results to a dictionary keyed by the file name.
@@ -325,7 +324,7 @@ def run_tests(self, test_files: Sequence[str]) -> dict[str, str]:
325324
if not fi.endswith(".py"):
326325
continue
327326
options.tweak(input=fi)
328-
with open(fi, "r") as test_file:
327+
with open(fi, "r", encoding="utf-8") as test_file:
329328
src = test_file.read()
330329
try:
331330
analysis: pytype_analyze.Analysis = pytype_io.check_py(

0 commit comments

Comments
 (0)