diff --git a/.github/workflows/stubtest.yml b/.github/workflows/stubtest.yml index 3b9f7d493..3852bb787 100644 --- a/.github/workflows/stubtest.yml +++ b/.github/workflows/stubtest.yml @@ -1,4 +1,4 @@ -name: Run stubtest on all stubs +name: Daily test on: workflow_dispatch: @@ -35,7 +35,11 @@ jobs: - name: Update pip run: python -m pip install -U pip - name: Install dependencies - run: pip install $(grep tomli== requirements-tests.txt) $(grep mypy== requirements-tests.txt) + # Use pre-release stubtest. Keep the following in sync: + # - 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 - name: Run stubtest run: python tests/stubtest_stdlib.py diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 21faf6365..f9ab66c51 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,4 +1,4 @@ -name: Check stubs +name: Test on: workflow_dispatch: @@ -110,7 +110,11 @@ jobs: - name: Update pip run: python -m pip install -U pip - name: Install dependencies - run: pip install $(grep tomli== requirements-tests.txt) $(grep mypy== requirements-tests.txt) + # Use pre-release stubtest. Keep the following in sync: + # - 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 - name: Run stubtest run: python tests/stubtest_stdlib.py diff --git a/tests/stubtest_allowlists/py310.txt b/tests/stubtest_allowlists/py310.txt index a74af2744..0381520aa 100644 --- a/tests/stubtest_allowlists/py310.txt +++ b/tests/stubtest_allowlists/py310.txt @@ -36,12 +36,10 @@ ast.Index.__new__ ast.NameConstant.__new__ ast.Num.__new__ ast.Str.__new__ -asyncio.compat # module removed in 3.7 asyncio.Future.__init__ # Usually initialized from c object asyncio.Future._callbacks # Usually initialized from c object asyncio.futures.Future.__init__ # Usually initialized from c object asyncio.futures.Future._callbacks # Usually initialized from c object -asyncio.taskgroups # Added in Python 3.11 builtins.dict.get contextvars.Context.__init__ # Default C __init__ signature is wrong contextlib.AbstractAsyncContextManager.__class_getitem__ @@ -69,6 +67,7 @@ multiprocessing.spawn._main os.PathLike.__class_getitem__ # PathLike is a protocol; we don't expect all PathLike classes to implement class_getitem pickle.Pickler.reducer_override # implemented in C pickler # platform.uname_result's processor field is now dynamically made to exist +platform.uname_result.__match_args__ platform.uname_result.__new__ platform.uname_result._fields platform.uname_result.processor @@ -130,8 +129,6 @@ os.path.join pstats.SortKey.__new__ tkinter.EventType.__new__ -distutils.command.bdist_wininst # removed in 3.10 - # stubtest complains that in 3.10 the default argument is inconsistent with the annotation, # but in 3.10+ calling the function without the default argument is in fact deprecated, # so it's better to ignore stubtest diff --git a/tests/stubtest_allowlists/py36.txt b/tests/stubtest_allowlists/py36.txt index 0760084be..8e96850cf 100644 --- a/tests/stubtest_allowlists/py36.txt +++ b/tests/stubtest_allowlists/py36.txt @@ -4,16 +4,8 @@ _collections_abc.AsyncGenerator.ag_frame _collections_abc.AsyncGenerator.ag_running _dummy_threading asyncio.Future.__init__ # Usually initialized from c object -asyncio.exceptions # Added in Python 3.8 -asyncio.format_helpers # Added in Python 3.7 asyncio.futures.Future.__init__ # Usually initialized from c object asyncio.futures._TracebackLogger.__init__ -asyncio.runners # Added in Python 3.7 -asyncio.staggered # Added in Python 3.8 -asyncio.threads # Added in Python 3.9 -asyncio.trsock # Added in Python 3.8 -asyncio.mixins # Added in Python 3.10 -asyncio.taskgroups # Added in Python 3.11 builtins.str.maketrans cmath.log collections.AsyncGenerator.ag_await @@ -34,9 +26,6 @@ dummy_threading.local.__new__ enum.Enum._generate_next_value_ fractions.Fraction.__new__ # overload is too complicated for stubtest to resolve hmac.HMAC.__init__ -importlib.metadata # Added in 3.8 -importlib.metadata._meta # Added in 3.10 -importlib.resources # Added in 3.7 io.StringIO.readline ipaddress._BaseNetwork.__init__ json.loads @@ -72,8 +61,6 @@ typing.Sequence.index typing.Text.maketrans typing.runtime_checkable typing\.\w+\.__new__ -unittest._log # New in Python 3.9 -unittest.async_case # Added in Python 3.8 uuid.UUID.int uuid.libname xml.etree.ElementTree.TreeBuilder.start # Discrepancy between Python and C modules, fixed in bpo-39495 diff --git a/tests/stubtest_allowlists/py37.txt b/tests/stubtest_allowlists/py37.txt index ce9a8ebd3..cea523107 100644 --- a/tests/stubtest_allowlists/py37.txt +++ b/tests/stubtest_allowlists/py37.txt @@ -3,17 +3,10 @@ _collections_abc.AsyncGenerator.ag_code _collections_abc.AsyncGenerator.ag_frame _collections_abc.AsyncGenerator.ag_running _dummy_threading -asyncio.compat # Removed in 3.7 asyncio.Future.__init__ # Usually initialized from c object asyncio.Future._callbacks # Usually initialized from c object -asyncio.exceptions # Added in Python 3.8 asyncio.futures.Future.__init__ # Usually initialized from c object asyncio.futures.Future._callbacks # Usually initialized from c object -asyncio.staggered # Added in Python 3.8 -asyncio.threads # Added in Python 3.9 -asyncio.trsock # Added in Python 3.8 -asyncio.mixins # Added in Python 3.10 -asyncio.taskgroups # Added in Python 3.11 builtins.dict.get builtins.str.maketrans cmath.log @@ -34,8 +27,6 @@ enum.Enum._generate_next_value_ fractions.Fraction.__new__ # overload is too complicated for stubtest to resolve hmac.HMAC.__init__ http.server.SimpleHTTPRequestHandler.__init__ # *args is expanded -importlib.metadata # Added in 3.8 -importlib.metadata._meta # Added in 3.10 ipaddress._BaseNetwork.__init__ json.loads multiprocessing.shared_memory @@ -58,8 +49,6 @@ typing._SpecialForm.__init__ typing._SpecialForm.__new__ typing.runtime_checkable typing.Text.maketrans -unittest._log # New in Python 3.9 -unittest.async_case # Added in Python 3.8 uuid.UUID.int uuid.UUID.is_safe uuid.getnode # undocumented, unused parameter getters that was later removed diff --git a/tests/stubtest_allowlists/py38.txt b/tests/stubtest_allowlists/py38.txt index 099aa9c0a..395bdd46f 100644 --- a/tests/stubtest_allowlists/py38.txt +++ b/tests/stubtest_allowlists/py38.txt @@ -11,14 +11,10 @@ ast.Ellipsis.__new__ ast.NameConstant.__new__ ast.Num.__new__ ast.Str.__new__ -asyncio.compat # removed in 3.7 asyncio.Future.__init__ # Usually initialized from c object asyncio.Future._callbacks # Usually initialized from c object asyncio.futures.Future.__init__ # Usually initialized from c object asyncio.futures.Future._callbacks # Usually initialized from c object -asyncio.threads # Added in Python 3.9 -asyncio.mixins # Added in Python 3.10 -asyncio.taskgroups # Added in Python 3.11 builtins.dict.get collections.AsyncGenerator.ag_await collections.AsyncGenerator.ag_code @@ -42,7 +38,6 @@ gettext.install # codeset default value is ['unspecified'] so can't be specifie gettext.translation # codeset default value is ['unspecified'] so can't be specified hmac.new # Stub is a white lie; see comments in the stub http.server.SimpleHTTPRequestHandler.__init__ # *args is expanded -importlib.metadata._meta # Added in 3.10 ipaddress.IPv4Interface.hostmask ipaddress.IPv6Interface.hostmask ipaddress._BaseNetwork.broadcast_address @@ -74,7 +69,6 @@ typing.SupportsInt.__init__ typing.SupportsRound.__init__ typing._SpecialForm.__init__ typing._SpecialForm.__new__ -unittest._log # New in Python 3.9 uuid.getnode # undocumented, unused parameter getters that was later removed weakref.WeakValueDictionary.update xml.etree.ElementTree.TreeBuilder.start # Discrepancy between Python and C modules, fixed in bpo-39495 diff --git a/tests/stubtest_allowlists/py39.txt b/tests/stubtest_allowlists/py39.txt index e290f1774..0aa088188 100644 --- a/tests/stubtest_allowlists/py39.txt +++ b/tests/stubtest_allowlists/py39.txt @@ -14,13 +14,10 @@ ast.Index.__new__ ast.NameConstant.__new__ ast.Num.__new__ ast.Str.__new__ -asyncio.compat # module removed in 3.7 asyncio.Future.__init__ # Usually initialized from c object asyncio.Future._callbacks # Usually initialized from c object asyncio.futures.Future.__init__ # Usually initialized from c object asyncio.futures.Future._callbacks # Usually initialized from c object -asyncio.mixins # Added in Python 3.10 -asyncio.taskgroups # Added in Python 3.11 builtins.dict.get collections.AsyncGenerator.ag_await collections.AsyncGenerator.ag_code @@ -44,7 +41,6 @@ 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 -importlib.metadata._meta # Added in 3.10 ipaddress.IPv4Interface.hostmask ipaddress.IPv6Interface.hostmask ipaddress._BaseNetwork.broadcast_address diff --git a/tests/stubtest_allowlists/py3_common.txt b/tests/stubtest_allowlists/py3_common.txt index eccbb4970..fffd72f49 100644 --- a/tests/stubtest_allowlists/py3_common.txt +++ b/tests/stubtest_allowlists/py3_common.txt @@ -201,8 +201,6 @@ multiprocessing.dummy.Lock # Similar to above multiprocessing.dummy.RLock # Similar to above tkinter.Misc.grid_propagate # The noarg placeholder is a set value list tkinter.Misc.pack_propagate # The noarg placeholder is a set value list -tkinter.Misc.grid_columnconfigure # an empty dict literal is actually a valid default for a TypedDict(total=False) parameter -tkinter.Misc.grid_rowconfigure # an empty dict literal is actually a valid default for a TypedDict(total=False) parameter tkinter.Tk.eval # from __getattr__ tkinter.Tk.report_callback_exception # A bit of a lie, since it's actually a method, but typing it as an attribute allows it to be assigned to tkinter.Wm.wm_iconphoto # Default value of argument can't be used without runtime error diff --git a/tests/stubtest_third_party.py b/tests/stubtest_third_party.py index 0f5a4888b..f5d5583a0 100755 --- a/tests/stubtest_third_party.py +++ b/tests/stubtest_third_party.py @@ -18,6 +18,12 @@ import tomli @functools.lru_cache() def get_mypy_req(): + # Use pre-release stubtest. Keep the following in sync: + # - 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" + with open("requirements-tests.txt") as f: return next(line.strip() for line in f if "mypy" in line)