changeset 52432:b2821a846470

tests: enable pytype checking on `mercurial/interfaces` package I might regret this, but the files currently scan OK, with the exception of one place where an `attribute-error` is now disabled. We should fix this somehow, but the rest of this package needs to be converted to Protocol classes first. I'm enabling checking on this now because I got to the tail end of the series converting this to Protocol classes, and suddenly one of the commits is causing pytype to fail with an error message that doesn't really jive with the few code changes in it. Then when I ran `pytype-single` on it to get a result faster, I got a host of other unexpected errors that were likely from earlier in the series. So first things first, strictly check the content of these files going forward.
author Matt Harbison <matt_harbison@yahoo.com>
date Fri, 06 Dec 2024 23:03:13 -0500
parents 2c8c46c3c401
children 9db98b503596
files contrib/check-pytype.sh mercurial/interfaces/repository.py
diffstat 2 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/check-pytype.sh	Sat Dec 07 01:57:55 2024 -0500
+++ b/contrib/check-pytype.sh	Fri Dec 06 23:03:13 2024 -0500
@@ -54,7 +54,6 @@
 # mercurial/hgweb/server.py     # [attribute-error], [name-error], [module-attr]
 # mercurial/hgweb/wsgicgi.py    # confused values in os.environ
 # mercurial/httppeer.py         # [attribute-error], [wrong-arg-types]
-# mercurial/interfaces          # No attribute 'capabilities' on peer [attribute-error]
 # mercurial/keepalive.py        # [attribute-error]
 # mercurial/localrepo.py        # [attribute-error]
 # mercurial/minirst.py          # [unsupported-operands], [attribute-error]
@@ -115,7 +114,6 @@
     -x mercurial/hgweb/server.py \
     -x mercurial/hgweb/wsgicgi.py \
     -x mercurial/httppeer.py \
-    -x mercurial/interfaces \
     -x mercurial/keepalive.py \
     -x mercurial/localrepo.py \
     -x mercurial/minirst.py \
--- a/mercurial/interfaces/repository.py	Sat Dec 07 01:57:55 2024 -0500
+++ b/mercurial/interfaces/repository.py	Fri Dec 06 23:03:13 2024 -0500
@@ -405,7 +405,9 @@
         self.path = path
 
     def capable(self, name):
-        caps = self.capabilities()
+        # TODO: this class should maybe subclass ipeercommands too, otherwise it
+        #  is assuming whatever uses this as a mixin also has this interface.
+        caps = self.capabilities()  # pytype: disable=attribute-error
         if name in caps:
             return True