Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion stubs/invoke/@tests/test_cases/check_task.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# pyright: reportUnnecessaryTypeIgnoreComment=true
from __future__ import annotations

from invoke import Context, task
Expand Down
1 change: 0 additions & 1 deletion stubs/protobuf/@tests/test_cases/check_struct.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# pyright: reportUnnecessaryTypeIgnoreComment=true
from __future__ import annotations

from google.protobuf.struct_pb2 import ListValue, Struct
Expand Down
2 changes: 0 additions & 2 deletions stubs/regex/@tests/test_cases/check_finditer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# pyright: reportUnnecessaryTypeIgnoreComment=true

from __future__ import annotations

from typing import List
Expand Down
2 changes: 0 additions & 2 deletions stubs/requests/@tests/test_cases/check_post.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# pyright: reportUnnecessaryTypeIgnoreComment=true

from __future__ import annotations

from collections.abc import Iterable
Expand Down
10 changes: 1 addition & 9 deletions tests/check_consistent.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,22 +67,14 @@ def check_stubs() -> None:


def check_test_cases() -> None:
for package_name, testcase_dir in get_all_testcase_directories():
for _package_name, testcase_dir in get_all_testcase_directories():
assert_consistent_filetypes(testcase_dir, kind=".py", allowed={"README.md"}, allow_nonidentifier_filenames=True)
bad_test_case_filename = 'Files in a `test_cases` directory must have names starting with "check_"; got "{}"'
for file in testcase_dir.rglob("*.py"):
assert file.stem.startswith("check_"), bad_test_case_filename.format(file)
with open(file, encoding="UTF-8") as f:
lines = {line.strip() for line in f}
assert "from __future__ import annotations" in lines, "Test-case files should use modern typing syntax where possible"
if package_name != "stdlib":
pyright_setting_not_enabled_msg = (
f'Third-party test-case file "{file}" must have '
f'"# pyright: reportUnnecessaryTypeIgnoreComment=true" '
f"at the top of the file"
)
has_pyright_setting_enabled = "# pyright: reportUnnecessaryTypeIgnoreComment=true" in lines
assert has_pyright_setting_enabled, pyright_setting_not_enabled_msg


def check_no_symlinks() -> None:
Expand Down