diff --git a/conformance/README.md b/conformance/README.md index c5f04b0d1..a0a821359 100644 --- a/conformance/README.md +++ b/conformance/README.md @@ -60,7 +60,7 @@ To run the conformance test suite: * Switch to the `conformance` subdirectory and install all dependencies (`pip install -r requirements.txt`). * Switch to the `src` subdirectory and run `python main.py`. -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. +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. ## Reporting Conformance Results diff --git a/conformance/requirements.txt b/conformance/requirements.txt index 396b5100d..d4c4d5a86 100644 --- a/conformance/requirements.txt +++ b/conformance/requirements.txt @@ -5,4 +5,4 @@ pyright mypy pip pyre-check -pytype; platform_system != "Windows" +pytype diff --git a/conformance/src/main.py b/conformance/src/main.py index 02453f9f8..3f4b12973 100644 --- a/conformance/src/main.py +++ b/conformance/src/main.py @@ -67,7 +67,7 @@ def f(): pass # E[final] {"final": [3, 4]} ) """ - with open(test_case, "r") as f: + with open(test_case, "r", encoding="utf-8") as f: lines = f.readlines() output: dict[int, tuple[int, int]] = {} groups: dict[str, list[int]] = {} diff --git a/conformance/src/type_checker.py b/conformance/src/type_checker.py index 21bec0d8f..d5ee0dfa7 100644 --- a/conformance/src/type_checker.py +++ b/conformance/src/type_checker.py @@ -3,7 +3,6 @@ """ from abc import ABC, abstractmethod -from curses.ascii import isspace import json from pathlib import Path import os @@ -114,7 +113,7 @@ def run_tests(self, test_files: Sequence[str]) -> dict[str, str]: "--enable-error-code", "deprecated", ] - proc = run(command, stdout=PIPE, text=True) + proc = run(command, stdout=PIPE, text=True, encoding="utf-8") lines = proc.stdout.split("\n") # Add results to a dictionary keyed by the file name. @@ -174,7 +173,7 @@ def get_version(self) -> str: def run_tests(self, test_files: Sequence[str]) -> dict[str, str]: command = [sys.executable, "-m", "pyright", ".", "--outputjson"] - proc = run(command, stdout=PIPE, text=True) + proc = run(command, stdout=PIPE, text=True, encoding="utf-8") output_json = json.loads(proc.stdout) diagnostics = output_json["generalDiagnostics"] @@ -253,7 +252,7 @@ def get_version(self) -> str: return version def run_tests(self, test_files: Sequence[str]) -> dict[str, str]: - proc = run(["pyre", "check"], stdout=PIPE, text=True) + proc = run(["pyre", "check"], stdout=PIPE, text=True, encoding="utf-8") lines = proc.stdout.split("\n") # 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]: if not fi.endswith(".py"): continue options.tweak(input=fi) - with open(fi, "r") as test_file: + with open(fi, "r", encoding="utf-8") as test_file: src = test_file.read() try: analysis: pytype_analyze.Analysis = pytype_io.check_py(