Skip to content

Commit 2d9ea90

Browse files
authored
Conformance - fix issues on Windows (unicode, Pyre) (#1976)
* Conformance - fix saving toml results file in non-unicode Noticed that pyright is giving unicode output that on Windows is leading to issues generating reports later. Saving this output explicitly as unicode resolves the issue. ```python Generating summary report Traceback (most recent call last): File "\typing\conformance\src\main.py", line 260, in <module> main() File "\typing\conformance\src\main.py", line 256, in main generate_summary(root_dir) File "\typing\conformance\src\reporting.py", line 19, in generate_summary summary = template.replace("{{summary}}", generate_summary_html(root_dir)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "\typing\conformance\src\reporting.py", line 87, in generate_summary_html results = tomli.load(f) ^^^^^^^^^^^^^ File "src\tomli\_parser.py", line 134, in load UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa0 in position 110: invalid start byte ``` * Conformance - skip Pyre on Windows as it's not supported
1 parent 9df7bdf commit 2d9ea90

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

Diff for: conformance/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ 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. 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.
64+
Currently, the only unsupported type checker is Pyre on Windows.
6465

6566
## Reporting Conformance Results
6667

Diff for: conformance/requirements.txt

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

Diff for: conformance/src/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def update_output_for_test(
197197
notes = "\n" + notes
198198
existing_results["notes"] = tomlkit.string(notes, multiline=True)
199199
results_file.parent.mkdir(parents=True, exist_ok=True)
200-
with open(results_file, "w") as f:
200+
with open(results_file, "w", encoding="utf-8") as f:
201201
tomlkit.dump(existing_results, f)
202202

203203

Diff for: conformance/src/type_checker.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,6 @@ def parse_errors(self, output: Sequence[str]) -> dict[int, list[str]]:
387387
TYPE_CHECKERS: Sequence[TypeChecker] = (
388388
MypyTypeChecker(),
389389
PyrightTypeChecker(),
390-
PyreTypeChecker(),
390+
*([] if os.name == "nt" else [PyreTypeChecker()]),
391391
PytypeTypeChecker(),
392392
)

0 commit comments

Comments
 (0)