view mercurial/typelib.py @ 52155:74e16d8ca5f3 stable tip

tests: disable a section of `test-hgrc.t` that may hit a zeroconf bug This effectively re-disables the same test as cce9e7d2fb92, but unconditionally because it's not a pyoxidizer-specific problem (see below and 997c9b2069d1). I can run the test locally fine, with the same venv as CI is using, and have had multiple CI runs that don't hit this. But one failed with this: --- /private/tmp/mercurial-ci/tests/test-hgrc.t +++ /private/tmp/mercurial-ci/tests/test-hgrc.t.err @@ -305,5 +305,17 @@ [255] $ HGRCSKIPREPO=1 hg paths --config extensions.zeroconf= + Traceback (most recent call last): + File "/private/tmp/hgtests.7idf706t/install/lib/python/hgext/zeroconf/Zeroconf.py", line 966, in run + self.readers[sock].handle_read() + File "/private/tmp/hgtests.7idf706t/install/lib/python/hgext/zeroconf/Zeroconf.py", line 1020, in handle_read + msg = DNSIncoming(data) + File "/private/tmp/hgtests.7idf706t/install/lib/python/hgext/zeroconf/Zeroconf.py", line 537, in __init__ + self.readOthers() + File "/private/tmp/hgtests.7idf706t/install/lib/python/hgext/zeroconf/Zeroconf.py", line 650, in readOthers + self.readCharacterString(), + File "/private/tmp/hgtests.7idf706t/install/lib/python/hgext/zeroconf/Zeroconf.py", line 584, in readCharacterString + length = ord(self.data[self.offset]) + TypeError: ord() expected string of length 1, but int found foo = $TESTTMP/bar The zeroconf extension has bytes vs str problems that are obvious from inspection alone, and nobody has complained, so I'm not going to let this block getting CI for macOS up and running. Given that it's in the packet read code, I suspect that this 1) requires something on the network to speak mDNS, and 2) it is a timing issue if this is seen or not. (The bytes vs str issue itself is real, but only happen if a response is received quickly.)
author Matt Harbison <matt_harbison@yahoo.com>
date Fri, 11 Oct 2024 15:04:13 -0400
parents 82e2c99c84f3
children
line wrap: on
line source

# typelib.py - type hint aliases and support
#
# Copyright 2022 Matt Harbison <matt_harbison@yahoo.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.

from __future__ import annotations

import typing

from typing import (
    Callable,
)

# Note: this is slightly different from pycompat.TYPE_CHECKING, as using
# pycompat causes the BinaryIO_Proxy type to be resolved to ``object`` when
# used as the base class during a pytype run.
TYPE_CHECKING = typing.TYPE_CHECKING


# The BinaryIO class provides empty methods, which at runtime means that
# ``__getattr__`` on the proxy classes won't get called for the methods that
# should delegate to the internal object.  So to avoid runtime changes because
# of the required typing inheritance, just use BinaryIO when typechecking, and
# ``object`` otherwise.
if TYPE_CHECKING:
    from typing import (
        BinaryIO,
        Union,
    )

    from . import (
        node,
        posix,
        util,
        windows,
    )

    BinaryIO_Proxy = BinaryIO
    CacheStat = Union[
        posix.cachestat,
        windows.cachestat,
        util.uncacheable_cachestat,
    ]
    NodeConstants = node.sha1nodeconstants
else:
    from typing import Any

    BinaryIO_Proxy = object
    CacheStat = Any
    NodeConstants = Any

# scmutil.getuipathfn() related callback.
UiPathFn = Callable[[bytes], bytes]