Skip to content

Commit

Permalink
Update stubtest for final checking (#7312)
Browse files Browse the repository at this point in the history
Co-authored-by: hauntsaninja <>
  • Loading branch information
hauntsaninja authored Feb 20, 2022
1 parent 06a2024 commit 823592e
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/stubtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
# - get_mypy_req in tests/stubtest_third_party.py
# - stubtest-stdlib in .github/workflows/stubtest.yml
# - stubtest-stdlib in .github/workflows/tests.yml
run: pip install $(grep tomli== requirements-tests.txt) git+git://github.com/python/mypy@b36d8cf5d4d0bb77c5a8cf783ba4def16cd9846a
run: pip install $(grep tomli== requirements-tests.txt) git+git://github.com/python/mypy@080bb0e04e9d5c4d2513621d1fb62f1d61a573e9
- name: Run stubtest
run: python tests/stubtest_stdlib.py

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ jobs:
# - get_mypy_req in tests/stubtest_third_party.py
# - stubtest-stdlib in .github/workflows/stubtest.yml
# - stubtest-stdlib in .github/workflows/tests.yml
run: pip install $(grep tomli== requirements-tests.txt) git+git://github.com/python/mypy@b36d8cf5d4d0bb77c5a8cf783ba4def16cd9846a
run: pip install $(grep tomli== requirements-tests.txt) git+git://github.com/python/mypy@080bb0e04e9d5c4d2513621d1fb62f1d61a573e9
- name: Run stubtest
run: python tests/stubtest_stdlib.py

Expand Down
1 change: 1 addition & 0 deletions stdlib/select.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ if sys.platform != "linux" and sys.platform != "win32":
KQ_NOTE_WRITE: int

if sys.platform == "linux":
@final
class epoll:
def __init__(self, sizehint: int = ..., flags: int = ...) -> None: ...
def __enter__(self: Self) -> Self: ...
Expand Down
1 change: 1 addition & 0 deletions stdlib/sqlite3/dbapi2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ class Row:
def __ne__(self, __other): ...

if sys.version_info < (3, 8):
@final
class Statement:
def __init__(self, *args, **kwargs): ...

Expand Down
2 changes: 0 additions & 2 deletions tests/stubtest_allowlists/py310.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ fractions.Fraction.__new__ # overload is too complicated for stubtest to resolv
ftplib.FTP.trust_server_pasv_ipv4_address # Dangerous to use, intentionally undocumented, intentionally missing from typeshed. #6154
gettext.install
gettext.translation
hashlib.sha3_\d+ # Can be a class or a built-in function
hashlib.shake_\d+ # Can be a class or a built-in function
hmac.new # Stub is a white lie; see comments in the stub
http.server.SimpleHTTPRequestHandler.__init__ # *args is expanded
importlib.abc.Traversable.__init__ # Inherits __init__ from typing.Protocol
Expand Down
2 changes: 0 additions & 2 deletions tests/stubtest_allowlists/py39.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ fractions.Fraction.__new__ # overload is too complicated for stubtest to resolv
ftplib.FTP.trust_server_pasv_ipv4_address # Dangerous to use, intentionally undocumented, intentionally missing from typeshed. #6154
gettext.install
gettext.translation
hashlib.sha3_\d+
hashlib.shake_\d+
hmac.new # Stub is a white lie; see comments in the stub
http.server.SimpleHTTPRequestHandler.__init__ # *args is expanded
importlib.abc.Traversable.__init__ # Inherits __init__ from typing.Protocol
Expand Down
2 changes: 2 additions & 0 deletions tests/stubtest_allowlists/py3_common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ enum.Enum.value
enum.Flag.name
enum.Flag.value
enum.IntEnum.value
hashlib.sha3_\d+ # Can be a class or a built-in function, can't be subclassed at runtime
hashlib.shake_\d+ # Can be a class or a built-in function, can't be subclassed at runtime
http.HTTPStatus.description # set in __new__
http.HTTPStatus.phrase # set in __new__
http.client.HTTPConnection.response_class # the actual type at runtime is abc.ABCMeta
Expand Down
2 changes: 1 addition & 1 deletion tests/stubtest_third_party.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def get_mypy_req():
# - get_mypy_req in tests/stubtest_third_party.py
# - stubtest-stdlib in .github/workflows/stubtest.yml
# - stubtest-stdlib in .github/workflows/tests.yml
return "git+git://github.com/python/mypy@b36d8cf5d4d0bb77c5a8cf783ba4def16cd9846a"
return "git+git://github.com/python/mypy@080bb0e04e9d5c4d2513621d1fb62f1d61a573e9"

with open("requirements-tests.txt") as f:
return next(line.strip() for line in f if "mypy" in line)
Expand Down

0 comments on commit 823592e

Please sign in to comment.