Skip to content

Commit

Permalink
Make type completeness results consistent for different platforms (#2691
Browse files Browse the repository at this point in the history
)

* Use Linux as the platform for type consistency tests
* Sort sections of the verify_types file.
* Always use Python 3.8 as the Python version to test
  • Loading branch information
TeamSpen210 authored Jul 10, 2023
1 parent ed975f8 commit 6d71047
Show file tree
Hide file tree
Showing 2 changed files with 169 additions and 154 deletions.
17 changes: 16 additions & 1 deletion trio/_tests/check_type_completeness.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@
# removing it from the below call later on.
def run_pyright():
return subprocess.run(
["pyright", "--verifytypes=trio", "--outputjson", "--ignoreexternal"],
[
"pyright",
# Specify a platform and version to keep imported modules consistent.
"--pythonplatform=Linux",
"--pythonversion=3.8",
"--verifytypes=trio",
"--outputjson",
"--ignoreexternal",
],
capture_output=True,
)

Expand Down Expand Up @@ -148,6 +156,13 @@ def main(args: argparse.Namespace) -> int:
new_symbols.append(symbol["name"])
continue

# Ensure order of arrays does not affect result.
new_symbols.sort()
current_result["generalDiagnostics"].sort()
current_result["typeCompleteness"]["modules"].sort(
key=lambda module: module.get("name", "")
)

current_result["typeCompleteness"]["symbols"] = new_symbols

with open(RESULT_FILE, "w") as file:
Expand Down
Loading

0 comments on commit 6d71047

Please sign in to comment.