Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tests] Add a new unit test linting the @beartype codebase with ruff 😮‍💨 #366

Open
kloczek opened this issue Apr 14, 2024 · 9 comments

Comments

@kloczek
Copy link

kloczek commented Apr 14, 2024

I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

  • python3 -sBm build -w --no-isolation
  • because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
  • install .whl file in </install/prefix> using installer module
  • run pytest with $PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
  • build is performed in env which is cut off from access to the public network (pytest is executed with -m "not network")
Here is pytest output:
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-beartype-0.18.2-2.fc37.x86_64/usr/lib64/python3.10/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-beartype-0.18.2-2.fc37.x86_64/usr/lib/python3.10/site-packages
+ /usr/bin/pytest -ra -m 'not network' -q
============================= test session starts ==============================
platform linux -- Python 3.10.14, pytest-8.1.1, pluggy-1.4.0
rootdir: /home/tkloczko/rpmbuild/BUILD/beartype-0.18.2
configfile: pytest.ini
testpaths: beartype_test
collected 344 items

beartype_test/a00_unit/a00_core/test_a00_package.py ..                   [  0%]
beartype_test/a00_unit/a00_core/test_a90_typing.py .                     [  0%]
beartype_test/a00_unit/a10_data/code/test_datacodeindent.py .            [  1%]
beartype_test/a00_unit/a10_data/hint/pep/sign/test_datapepsignset.py .   [  1%]
beartype_test/a00_unit/a20_util/a00_cache/map/test_utilmapbig.py .       [  1%]
beartype_test/a00_unit/a20_util/a00_cache/map/test_utilmaplru.py ...     [  2%]
beartype_test/a00_unit/a20_util/a00_cache/pool/test_utilcachepool.py ..  [  3%]
beartype_test/a00_unit/a20_util/a00_cache/pool/test_utilcachepoollistfixed.py . [  3%]
...                                                                      [  4%]
beartype_test/a00_unit/a20_util/a00_cache/pool/test_utilcachepoolobjecttyped.py . [  4%]
.                                                                        [  4%]
beartype_test/a00_unit/a20_util/a00_cache/test_utilcachecall.py ...      [  5%]
beartype_test/a00_unit/a20_util/a00_cache/test_utilcachemeta.py .        [  6%]
beartype_test/a00_unit/a20_util/ast/test_utilastmake.py .                [  6%]
beartype_test/a00_unit/a20_util/ast/test_utilasttest.py .                [  6%]
beartype_test/a00_unit/a20_util/cls/pep/test_utilpep3119.py ....         [  7%]
beartype_test/a00_unit/a20_util/cls/pep/test_utilpep557.py .             [  8%]
beartype_test/a00_unit/a20_util/cls/test_utilclsget.py .                 [  8%]
beartype_test/a00_unit/a20_util/cls/test_utilclsmake.py .                [  8%]
beartype_test/a00_unit/a20_util/cls/test_utilclstest.py ....             [  9%]
beartype_test/a00_unit/a20_util/error/test_utilerrget.py .               [ 10%]
beartype_test/a00_unit/a20_util/error/test_utilerrraise.py .             [ 10%]
beartype_test/a00_unit/a20_util/error/test_utilerrwarn.py .              [ 10%]
beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargget.py ..       [ 11%]
beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargiter.py .       [ 11%]
beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargtest.py ...     [ 12%]
beartype_test/a00_unit/a20_util/func/mod/test_utilbeartypefunc.py ..     [ 13%]
beartype_test/a00_unit/a20_util/func/mod/test_utilfuncmodtest.py ..      [ 13%]
beartype_test/a00_unit/a20_util/func/pep/test_utilpep484func.py .        [ 13%]
beartype_test/a00_unit/a20_util/func/test_utilfunccode.py .              [ 14%]
beartype_test/a00_unit/a20_util/func/test_utilfunccodeobj.py ..          [ 14%]
beartype_test/a00_unit/a20_util/func/test_utilfuncfile.py ..             [ 15%]
beartype_test/a00_unit/a20_util/func/test_utilfuncframe.py ..            [ 15%]
beartype_test/a00_unit/a20_util/func/test_utilfuncget.py ..              [ 16%]
beartype_test/a00_unit/a20_util/func/test_utilfuncmake.py .              [ 16%]
beartype_test/a00_unit/a20_util/func/test_utilfuncscope.py ...           [ 17%]
beartype_test/a00_unit/a20_util/func/test_utilfunctest.py .............. [ 21%]
..                                                                       [ 22%]
beartype_test/a00_unit/a20_util/func/test_utilfuncwrap.py .              [ 22%]
beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484/test_utilpep484typevar.py . [ 22%]
                                                                         [ 22%]
beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585.py . [ 23%]
.                                                                        [ 23%]
beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585callable.py . [ 23%]
                                                                         [ 23%]
beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585generic.py . [ 24%]
...                                                                      [ 25%]
beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585ref.py . [ 25%]
.                                                                        [ 25%]
beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585type.py . [ 25%]
                                                                         [ 25%]
beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_utilpep544.py . [ 26%]
..                                                                       [ 26%]
beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_utilpep557.py . [ 27%]
                                                                         [ 27%]
beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_utilpep561.py . [ 27%]
                                                                         [ 27%]
beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_utilpep585.py . [ 27%]
..                                                                       [ 28%]
beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_utilpep586.py . [ 28%]
                                                                         [ 28%]
beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_utilpep589.py . [ 28%]
                                                                         [ 28%]
beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_utilpep593.py . [ 29%]
...                                                                      [ 29%]
beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_utilpep604.py . [ 30%]
                                                                         [ 30%]
beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_utilpep695.py . [ 30%]
.                                                                        [ 30%]
beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py .... [ 31%]
.                                                                        [ 32%]
beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py ... [ 33%]
....                                                                     [ 34%]
beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py . [ 34%]
..                                                                       [ 35%]
beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhintfactory.py .  [ 35%]
beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhintget.py .      [ 35%]
beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py ....  [ 36%]
beartype_test/a00_unit/a20_util/kind/map/test_utilmapfrozen.py .         [ 37%]
beartype_test/a00_unit/a20_util/kind/map/test_utilmapset.py ...          [ 38%]
beartype_test/a00_unit/a20_util/kind/map/test_utilmaptest.py ...         [ 38%]
beartype_test/a00_unit/a20_util/module/lib/test_utiltyping.py .          [ 39%]
beartype_test/a00_unit/a20_util/module/test_utilmoddeprecate.py .        [ 39%]
beartype_test/a00_unit/a20_util/module/test_utilmodget.py ...            [ 40%]
beartype_test/a00_unit/a20_util/module/test_utilmodimport.py ....        [ 41%]
beartype_test/a00_unit/a20_util/module/test_utilmodtest.py ..            [ 42%]
beartype_test/a00_unit/a20_util/os/test_utilostest.py ..                 [ 42%]
beartype_test/a00_unit/a20_util/os/test_utilostty.py .                   [ 43%]
beartype_test/a00_unit/a20_util/py/test_utilpyinterpreter.py ....        [ 44%]
beartype_test/a00_unit/a20_util/py/test_utilpyweakref.py ..              [ 44%]
beartype_test/a00_unit/a20_util/py/test_utilpyword.py .                  [ 45%]
beartype_test/a00_unit/a20_util/test_utilobject.py ....                  [ 46%]
beartype_test/a00_unit/a20_util/text/test_utiltextansi.py ..             [ 46%]
beartype_test/a00_unit/a20_util/text/test_utiltextidentifier.py ..       [ 47%]
beartype_test/a00_unit/a20_util/text/test_utiltextjoin.py ..             [ 47%]
beartype_test/a00_unit/a20_util/text/test_utiltextlabel.py ...           [ 48%]
beartype_test/a00_unit/a20_util/text/test_utiltextmunge.py .....         [ 50%]
beartype_test/a00_unit/a20_util/text/test_utiltextrepr.py ..             [ 50%]
beartype_test/a00_unit/a20_util/text/test_utiltextversion.py .           [ 51%]
beartype_test/a00_unit/a40_api/conf/test_confcls.py ..                   [ 51%]
beartype_test/a00_unit/a40_api/conf/test_confenum.py ..                  [ 52%]
beartype_test/a00_unit/a40_api/conf/test_confoverrides.py .              [ 52%]
beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py ..... [ 54%]
........                                                                 [ 56%]
beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py .         [ 56%]
beartype_test/a00_unit/a40_api/plug/test_plugmixin.py .                  [ 56%]
beartype_test/a00_unit/a40_api/test_api_cave.py .....                    [ 58%]
beartype_test/a00_unit/a40_api/test_api_meta.py .                        [ 58%]
beartype_test/a00_unit/a40_api/typing/test_typingpep544.py ........      [ 61%]
beartype_test/a00_unit/a40_api/vale/_core/test_valecore.py ..            [ 61%]
beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py ...               [ 62%]
beartype_test/a00_unit/a40_api/vale/_is/test_valeiscls.py ....           [ 63%]
beartype_test/a00_unit/a40_api/vale/_is/test_valeisobj.py ..             [ 64%]
beartype_test/a00_unit/a40_api/vale/_is/test_valeisoper.py ..            [ 64%]
beartype_test/a00_unit/a40_api/vale/_util/test_valeutiltext.py .         [ 65%]
beartype_test/a00_unit/a60_check/a00_code/snip/test_codesnipcls.py .     [ 65%]
beartype_test/a00_unit/a60_check/a00_code/test_codemake.py .             [ 65%]
beartype_test/a00_unit/a60_check/a00_code/test_codescope.py ...          [ 66%]
beartype_test/a00_unit/a60_check/a20_convert/test_convcoerce.py ..       [ 67%]
beartype_test/a00_unit/a60_check/a20_convert/test_convreduce.py .        [ 67%]
beartype_test/a00_unit/a60_check/a80_forward/reference/test_fwdrefmake.py . [ 67%]
                                                                         [ 67%]
beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py .....        [ 69%]
beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py .     [ 69%]
beartype_test/a00_unit/a60_check/test_checkcall.py .                     [ 69%]
beartype_test/a00_unit/a70_decor/a00_core/test_decormore.py .            [ 70%]
beartype_test/a00_unit/a70_decor/a20_error/a90_main/test_errorget.py ... [ 70%]
..                                                                       [ 71%]
beartype_test/a00_unit/a70_decor/a20_error/a90_main/test_errorplug.py .  [ 71%]
beartype_test/a00_unit/a70_decor/a40_code/a00_module/test_decor_contextlib.py s [ 72%]
                                                                         [ 72%]
beartype_test/a00_unit/a70_decor/a40_code/a00_module/test_decor_functools.py . [ 72%]
                                                                         [ 72%]
beartype_test/a00_unit/a70_decor/a40_code/a00_module/test_decor_mypy.py . [ 72%]
                                                                         [ 72%]
beartype_test/a00_unit/a70_decor/a40_code/a00_module/test_decor_nptyping.py s [ 72%]
                                                                         [ 72%]
beartype_test/a00_unit/a70_decor/a40_code/a00_module/test_decor_pandera.py s [ 73%]
                                                                         [ 73%]
beartype_test/a00_unit/a70_decor/a40_code/a80_nonpep/test_codenonpep.py . [ 73%]
........                                                                 [ 75%]
beartype_test/a00_unit/a70_decor/a40_code/a90_pep/pep484/test_pep484.py . [ 76%]
....                                                                     [ 77%]
beartype_test/a00_unit/a70_decor/a40_code/a90_pep/pep484/test_pep484ref.py . [ 77%]
....                                                                     [ 78%]
beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep3119.py . [ 79%]
                                                                         [ 79%]
beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep435663.py . [ 79%]
s                                                                        [ 79%]
beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep484585.py . [ 79%]
..                                                                       [ 80%]
beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep544.py .. [ 81%]
                                                                         [ 81%]
beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep557.py .  [ 81%]
beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep563.py .. [ 81%]
...s...                                                                  [ 84%]
beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep585.py .  [ 84%]
beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep591.py .  [ 84%]
beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep613.py .  [ 84%]
beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep647.py .  [ 85%]
beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep673.py s  [ 85%]
beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep695.py s  [ 85%]
beartype_test/a00_unit/a70_decor/a40_code/test_codeargkind.py ..s......  [ 88%]
beartype_test/a00_unit/a70_decor/a40_code/test_codenoop.py .......       [ 90%]
beartype_test/a00_unit/a70_decor/a40_code/test_codetype.py ...           [ 91%]
beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py .             [ 91%]
beartype_test/a00_unit/a70_decor/a80_conf/test_decorconf.py ...          [ 92%]
beartype_test/a00_unit/a70_decor/a90_roar/test_beartype_roar.py ..       [ 93%]
beartype_test/a00_unit/a70_decor/test_decorwrappee.py ......             [ 94%]
beartype_test/a00_unit/a70_decor/test_decorwrapper.py .                  [ 95%]
beartype_test/a00_unit/a90_claw/a00_core/test_claw_api.py .              [ 95%]
beartype_test/a00_unit/a90_claw/a90_hook/test_claw_extraprocess.py ..    [ 95%]
beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py ..... [ 97%]
                                                                         [ 97%]
beartype_test/a90_func/doc/test_docreadme.py .                           [ 97%]
beartype_test/a90_func/package/test_package_import.py .                  [ 97%]
beartype_test/a90_func/pep/test_pep561_static.py .F                      [ 98%]
beartype_test/a90_func/z90_lib/a00_sphinx/test_sphinx.py ..              [ 99%]
beartype_test/a90_func/z90_lib/a90_nuitka/test_nuitka.py s               [ 99%]
beartype_test/a90_func/z90_lib/test_equinox.py s                         [ 99%]
beartype_test/a90_func/z90_lib/test_torch.py s                           [100%]

=================================== FAILURES ===================================
_____________________________ test_pep561_pyright ______________________________

monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f5ab0cab460>

    @skip_unless_pathable('pyright')
    @skip_if_ci()
    def test_pep561_pyright(monkeypatch) -> None:
        '''
        Functional test testing this project's compliance with :pep:`561` by
        externally running :mod:`pyright` (i.e., the most popular third-party static
        type checker as of this test) against this project's top-level package.

        See Also
        ----------
        :mod:`pytest_pyright`
            Third-party :mod:`pytest` plugin automating this integration. Since this
            integration is trivial *and* since :mod:`beartype` assiduously avoids
            *all* mandatory dependencies, we perform this integration manually.
            Moreover, this plugin:

            * Internally violates privacy encapsulation in
              :mod:`pytest` by widely importing private :mod:`pytest` attributes.
            * Explicitly admonishes downstream dependencies *not* to depend upon
              this plugin:

                This project was created for internal use within another project of
                mine, support will be minimal.
        '''

        # ....................{ IMPORTS                        }....................
        # Defer test-specific imports.
        from beartype.meta import PACKAGE_NAME
        from beartype._util.py.utilpyversion import get_python_version_major_minor
        from beartype_test._util.command.pytcmdrun import run_command_forward_output
        from beartype_test._util.path.pytpathmain import get_main_dir

        # ....................{ COMMAND                        }....................
        # Tuple of all shell words with which to run the external "pyright" command.
        PYRIGHT_ARGS = (
            # Basename of the external "pyright" command to be run.
            'pyright',

            #FIXME: Note that we *COULD* additionally pass the "--verifytypes"
            #option, which exposes further "pyright" complaints. Let's avoid doing
            #so until someone explicitly requests we do so, please. This has dragged
            #on long enough, people!

            # Major and minor version of the active Python interpreter, ignoring the
            # patch version of this interpreter.
            '--pythonversion', get_python_version_major_minor(),

            # Relative basename of this project's top-level package. Ideally, the
            # absolute dirname of this package would instead be passed as:
            #     str(get_main_package_dir())
            #
            # Doing so succeeds when manually running tests via our top-level
            # "pytest" script but fails when automatically running tests via the
            # "tox" command, presumably due to "pyright" failing to recognize that
            # that dirname encapsulates a Python package. *sigh*
            PACKAGE_NAME,
        )

        # Temporarily change to the root directory for this project *BEFORE* running
        # the "pyright" command. Unlike the "mypy" command, "pyright" fails to
        # accept an option or argument specifying the target directory containing
        # the specified package. If this directory is *NOT* changed to here,
        # "pyright" fails with a fatal error under "tox" resembling:
        #      File or directory
        #      "/home/leycec/py/beartype/.tox/py311-coverage/tmp/beartype" does not
        #      exist.
        monkeypatch.chdir(str(get_main_dir()))

        # Run this command, raising an exception on subprocess failure while
        # forwarding all standard output and error output by this subprocess to the
        # standard output and error file handles of the active Python process.
>       run_command_forward_output(command_words=PYRIGHT_ARGS)

PACKAGE_NAME = 'beartype'
PYRIGHT_ARGS = ('pyright', '--pythonversion', '3.10', 'beartype')
get_main_dir = <function get_main_dir at 0x7f5ab0acab90>
get_python_version_major_minor = <function get_python_version_major_minor at 0x7f5c36c195a0>
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f5ab0cab460>
run_command_forward_output = <function run_command_forward_output at 0x7f5ab0ac9900>

beartype_test/a90_func/pep/test_pep561_static.py:238:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

command_words = ('pyright', '--pythonversion', '3.10', 'beartype')
popen_kwargs = None

    def run_command_forward_output(
        # Mandatory parameters.
        command_words: CommandWords,

        # Optional parameters.
        popen_kwargs: _HINT_POPEN_KWARGS_OPTIONAL = None,
    ) -> None:
        '''
        Run the passed command as a subprocess of the active Python process,
        raising an exception on subprocess failure while forwarding all standard
        output and error output by this subprocess to the standard output and error
        file handles of the active Python process.

        This exception contains the exit status of this subprocess.

        Parameters
        ----------
        command_words : CommandWords
            Iterable of one or more shell words comprising this command.
        popen_kwargs : _HINT_POPEN_KWARGS_OPTIONAL
            Dictionary of all keyword arguments to be passed to the
            :meth:`subprocess.Popen.__init__` method. Defaults to :data:`None`, in
            which case the empty dictionary is assumed.

        Raises
        ----------
        CalledProcessError
            If the subprocess running this command report non-zero exit status.
        '''

        # Defer test-specific imports.
        from beartype_test._util.command.pytcmdexit import is_failure

        # 0-based exit status reported by running this command.
        exit_status = run_command_forward_output_return_status(
            command_words=command_words, popen_kwargs=popen_kwargs)

        # If this command failed, raising an exception on command failure. For
        # reusability, we reimplement the subprocess.check_call() function here
        # rather than explicitly call that function. The latter approach would
        # require duplicating logic between this and the
        # run_command_forward_output_return_status() runner called above.
        if is_failure(exit_status):
>           raise CalledProcessError(exit_status, command_words)
E           subprocess.CalledProcessError: Command '('pyright', '--pythonversion', '3.10', 'beartype')' returned non-zero exit status 1.

command_words = ('pyright', '--pythonversion', '3.10', 'beartype')
exit_status = 1
is_failure = <function is_failure at 0x7f5ab09b5a20>
popen_kwargs = None

beartype_test/_util/command/pytcmdrun.py:213: CalledProcessError
----------------------------- Captured stderr call -----------------------------
internal/modules/cjs/loader.js:895
    throw err;
    ^

Error: Cannot find module 'node:util'
Require stack:
- /home/tkloczko/.cache/pyright-python/1.1.358/node_modules/pyright/dist/pyright.js
- /home/tkloczko/.cache/pyright-python/1.1.358/node_modules/pyright/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:892:15)
    at Function.Module._load (internal/modules/cjs/loader.js:785:27)
    at Module.require (internal/modules/cjs/loader.js:956:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.9632 (/home/tkloczko/.cache/pyright-python/1.1.358/node_modules/pyright/dist/pyright.js:1:610)
    at o (/home/tkloczko/.cache/pyright-python/1.1.358/node_modules/pyright/dist/pyright.js:1:1243)
    at Object.1264 (/home/tkloczko/.cache/pyright-python/1.1.358/node_modules/pyright/dist/vendor.js:2:768634)
    at o (/home/tkloczko/.cache/pyright-python/1.1.358/node_modules/pyright/dist/pyright.js:1:1243)
    at Object.6476 (/home/tkloczko/.cache/pyright-python/1.1.358/node_modules/pyright/dist/pyright-internal.js:1:1105791)
    at o (/home/tkloczko/.cache/pyright-python/1.1.358/node_modules/pyright/dist/pyright.js:1:1243) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/tkloczko/.cache/pyright-python/1.1.358/node_modules/pyright/dist/pyright.js',
    '/home/tkloczko/.cache/pyright-python/1.1.358/node_modules/pyright/index.js'
  ]
}
=========================== short test summary info ============================
SKIPPED [1] beartype_test/a00_unit/a70_decor/a40_code/a00_module/test_decor_contextlib.py:21: Python 3.10.14 < 3.11.0.
SKIPPED [1] beartype_test/a00_unit/a70_decor/a40_code/a00_module/test_decor_nptyping.py:30: could not import 'nptyping': No module named 'nptyping'
SKIPPED [1] beartype_test/a00_unit/a70_decor/a40_code/a00_module/test_decor_pandera.py:22: could not import 'pandera': No module named 'pandera'
SKIPPED [1] beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep435663.py:64: Python 3.10.14 < 3.11.0.
SKIPPED [1] beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep563.py:298: Python 3.10.14 >= 3.10.0.
SKIPPED [1] beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep673.py:21: Python 3.10.14 < 3.11.0.
SKIPPED [1] beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep695.py:21: Python 3.10.14 < 3.12.0.
SKIPPED [1] beartype_test/a00_unit/a70_decor/a40_code/test_codeargkind.py:80: Currently broken due to known issues in decoration-time type-checking.
SKIPPED [1] beartype_test/a90_func/z90_lib/a90_nuitka/test_nuitka.py:31: could not import 'nuitka': No module named 'nuitka'
SKIPPED [1] beartype_test/a90_func/z90_lib/test_equinox.py:21: could not import 'equinox': No module named 'equinox'
SKIPPED [1] beartype_test/a90_func/z90_lib/test_torch.py:21: could not import 'torch': No module named 'torch'
FAILED beartype_test/a90_func/pep/test_pep561_static.py::test_pep561_pyright
================== 1 failed, 332 passed, 11 skipped in 39.00s ==================
List of installed modules in build env:
Package                       Version
----------------------------- -----------
alabaster                     0.7.16
anyascii                      0.3.2
astroid                       3.2.0.dev0
Babel                         2.14.0
build                         1.2.1
charset-normalizer            3.3.2
docutils                      0.20.1
exceptiongroup                1.1.3
idna                          3.7
imagesize                     1.4.1
importlib_metadata            7.1.0
iniconfig                     2.0.0
installer                     0.7.0
Jinja2                        3.1.3
MarkupSafe                    2.1.5
mypy                          1.9.0
mypy_extensions               1.0.0
nodeenv                       1.8.0
numpy                         1.26.5
packaging                     24.0
pluggy                        1.4.0
Pygments                      2.17.2
pyproject_hooks               1.0.0
pyright                       1.1.358
pytest                        8.1.1
python-dateutil               2.9.0.post0
PyYAML                        6.0.1
requests                      2.31.0
setuptools                    69.4.0
snowballstemmer               2.2.0
Sphinx                        7.2.6
sphinx-autoapi                3.0.0
sphinxcontrib-applehelp       1.0.8
sphinxcontrib-devhelp         1.0.6
sphinxcontrib-htmlhelp        2.0.5
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.7
sphinxcontrib-serializinghtml 1.1.10
tokenize_rt                   5.2.0
tomli                         2.0.1
typing_extensions             4.11.0
urllib3                       2.2.1
wheel                         0.43.0
zipp                          3.18.1

Please let me know if you need more details or want me to perform some diagnostics.

@leycec
Copy link
Member

leycec commented Apr 15, 2024

Thanks so much for packaging @beartype, @kloczek. Sadly, it looks like your pyright installation is busted. @beartype weeps for you. From the above pytest output:

Error: Cannot find module 'node:util'
Require stack:
- /home/tkloczko/.cache/pyright-python/1.1.358/node_modules/pyright/dist/pyright.js
- /home/tkloczko/.cache/pyright-python/1.1.358/node_modules/pyright/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:892:15)
    at Function.Module._load (internal/modules/cjs/loader.js:785:27)
    at Module.require (internal/modules/cjs/loader.js:956:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.9632 (/home/tkloczko/.cache/pyright-python/1.1.358/node_modules/pyright/dist/pyright.js:1:610)
    at o (/home/tkloczko/.cache/pyright-python/1.1.358/node_modules/pyright/dist/pyright.js:1:1243)
    at Object.1264 (/home/tkloczko/.cache/pyright-python/1.1.358/node_modules/pyright/dist/vendor.js:2:768634)
    at o (/home/tkloczko/.cache/pyright-python/1.1.358/node_modules/pyright/dist/pyright.js:1:1243)
    at Object.6476 (/home/tkloczko/.cache/pyright-python/1.1.358/node_modules/pyright/dist/pyright-internal.js:1:1105791)
    at o (/home/tkloczko/.cache/pyright-python/1.1.358/node_modules/pyright/dist/pyright.js:1:1243) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/tkloczko/.cache/pyright-python/1.1.358/node_modules/pyright/dist/pyright.js',
    '/home/tkloczko/.cache/pyright-python/1.1.358/node_modules/pyright/index.js'
  ]

Moreover, I've personally verified right now that pyright 1.1.358 happily accepts @beartype:

$ pwd
/home/leycec/py/beartype
$ pyright --version
1.1.358
$ pyright
0 errors, 0 warnings, 0 informations

@beartype's paws our tied here. NodeJS-driven installation woes is outside our locus of obsessive-compulsive control. With my deepest apologies, let's quietly close this as we wish @kloczek all the best in resolving this special pyright madness. 😮‍💨

@leycec leycec closed this as completed Apr 15, 2024
@kloczek
Copy link
Author

kloczek commented Apr 15, 2024

@beartype's paws our tied here. NodeJS-driven installation woes is outside our locus of obsessive-compulsive control. With my deepest apologies, let's quietly close this as we wish @kloczek all the best in resolving this special pyright madness. 😮‍💨

Ok .. so what I can try to do to diagnose this issue? 😋

@kloczek
Copy link
Author

kloczek commented Apr 15, 2024

Odd .. just retested one more time and looks like pytest is happy

Here is pytest output:
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-beartype-0.18.2-2.fc37.x86_64/usr/lib64/python3.10/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-beartype-0.18.2-2.fc37.x86_64/usr/lib/python3.10/site-packages
+ /usr/bin/pytest -ra -m 'not network' -q
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.10.14, pytest-8.1.1, pluggy-1.4.0
benchmark: 4.0.0 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /home/tkloczko/rpmbuild/BUILD/beartype-0.18.2
configfile: pytest.ini
testpaths: beartype_test
plugins: hypothesis-6.100.0, benchmark-4.0.0, mock-3.14.0, subprocess-1.5.0, pyfakefs-5.4.1, rerunfailures-12.0
collected 344 items

beartype_test/a00_unit/a00_core/test_a00_package.py ..                                                                                                                                [  0%]
beartype_test/a00_unit/a00_core/test_a90_typing.py .                                                                                                                                  [  0%]
beartype_test/a00_unit/a10_data/code/test_datacodeindent.py .                                                                                                                         [  1%]
beartype_test/a00_unit/a10_data/hint/pep/sign/test_datapepsignset.py .                                                                                                                [  1%]
beartype_test/a00_unit/a20_util/a00_cache/map/test_utilmapbig.py .                                                                                                                    [  1%]
beartype_test/a00_unit/a20_util/a00_cache/map/test_utilmaplru.py ...                                                                                                                  [  2%]
beartype_test/a00_unit/a20_util/a00_cache/pool/test_utilcachepool.py ..                                                                                                               [  3%]
beartype_test/a00_unit/a20_util/a00_cache/pool/test_utilcachepoollistfixed.py ....                                                                                                    [  4%]
beartype_test/a00_unit/a20_util/a00_cache/pool/test_utilcachepoolobjecttyped.py ..                                                                                                    [  4%]
beartype_test/a00_unit/a20_util/a00_cache/test_utilcachecall.py ...                                                                                                                   [  5%]
beartype_test/a00_unit/a20_util/a00_cache/test_utilcachemeta.py .                                                                                                                     [  6%]
beartype_test/a00_unit/a20_util/ast/test_utilastmake.py .                                                                                                                             [  6%]
beartype_test/a00_unit/a20_util/ast/test_utilasttest.py .                                                                                                                             [  6%]
beartype_test/a00_unit/a20_util/cls/pep/test_utilpep3119.py ....                                                                                                                      [  7%]
beartype_test/a00_unit/a20_util/cls/pep/test_utilpep557.py .                                                                                                                          [  8%]
beartype_test/a00_unit/a20_util/cls/test_utilclsget.py .                                                                                                                              [  8%]
beartype_test/a00_unit/a20_util/cls/test_utilclsmake.py .                                                                                                                             [  8%]
beartype_test/a00_unit/a20_util/cls/test_utilclstest.py ....                                                                                                                          [  9%]
beartype_test/a00_unit/a20_util/error/test_utilerrget.py .                                                                                                                            [ 10%]
beartype_test/a00_unit/a20_util/error/test_utilerrraise.py .                                                                                                                          [ 10%]
beartype_test/a00_unit/a20_util/error/test_utilerrwarn.py .                                                                                                                           [ 10%]
beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargget.py ..                                                                                                                    [ 11%]
beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargiter.py .                                                                                                                    [ 11%]
beartype_test/a00_unit/a20_util/func/arg/test_utilfuncargtest.py ...                                                                                                                  [ 12%]
beartype_test/a00_unit/a20_util/func/mod/test_utilbeartypefunc.py ..                                                                                                                  [ 13%]
beartype_test/a00_unit/a20_util/func/mod/test_utilfuncmodtest.py ..                                                                                                                   [ 13%]
beartype_test/a00_unit/a20_util/func/pep/test_utilpep484func.py .                                                                                                                     [ 13%]
beartype_test/a00_unit/a20_util/func/test_utilfunccode.py .                                                                                                                           [ 14%]
beartype_test/a00_unit/a20_util/func/test_utilfunccodeobj.py ..                                                                                                                       [ 14%]
beartype_test/a00_unit/a20_util/func/test_utilfuncfile.py ..                                                                                                                          [ 15%]
beartype_test/a00_unit/a20_util/func/test_utilfuncframe.py ..                                                                                                                         [ 15%]
beartype_test/a00_unit/a20_util/func/test_utilfuncget.py ..                                                                                                                           [ 16%]
beartype_test/a00_unit/a20_util/func/test_utilfuncmake.py .                                                                                                                           [ 16%]
beartype_test/a00_unit/a20_util/func/test_utilfuncscope.py ...                                                                                                                        [ 17%]
beartype_test/a00_unit/a20_util/func/test_utilfunctest.py ................                                                                                                            [ 22%]
beartype_test/a00_unit/a20_util/func/test_utilfuncwrap.py .                                                                                                                           [ 22%]
beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484/test_utilpep484typevar.py .                                                                                              [ 22%]
beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585.py ..                                                                                              [ 23%]
beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585callable.py .                                                                                       [ 23%]
beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585generic.py ....                                                                                     [ 25%]
beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585ref.py ..                                                                                           [ 25%]
beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585type.py .                                                                                           [ 25%]
beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_utilpep544.py ...                                                                                                          [ 26%]
beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_utilpep557.py .                                                                                                            [ 27%]
beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_utilpep561.py .                                                                                                            [ 27%]
beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_utilpep585.py ...                                                                                                          [ 28%]
beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_utilpep586.py .                                                                                                            [ 28%]
beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_utilpep589.py .                                                                                                            [ 28%]
beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_utilpep593.py ....                                                                                                         [ 29%]
beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_utilpep604.py .                                                                                                            [ 30%]
beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_utilpep695.py ..                                                                                                           [ 30%]
beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py .....                                                                                                             [ 32%]
beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py .......                                                                                                          [ 34%]
beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py ...                                                                                                        [ 35%]
beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhintfactory.py .                                                                                                               [ 35%]
beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhintget.py .                                                                                                                   [ 35%]
beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py ....                                                                                                               [ 36%]
beartype_test/a00_unit/a20_util/kind/map/test_utilmapfrozen.py .                                                                                                                      [ 37%]
beartype_test/a00_unit/a20_util/kind/map/test_utilmapset.py ...                                                                                                                       [ 38%]
beartype_test/a00_unit/a20_util/kind/map/test_utilmaptest.py ...                                                                                                                      [ 38%]
beartype_test/a00_unit/a20_util/module/lib/test_utiltyping.py .                                                                                                                       [ 39%]
beartype_test/a00_unit/a20_util/module/test_utilmoddeprecate.py .                                                                                                                     [ 39%]
beartype_test/a00_unit/a20_util/module/test_utilmodget.py ...                                                                                                                         [ 40%]
beartype_test/a00_unit/a20_util/module/test_utilmodimport.py ....                                                                                                                     [ 41%]
beartype_test/a00_unit/a20_util/module/test_utilmodtest.py ..                                                                                                                         [ 42%]
beartype_test/a00_unit/a20_util/os/test_utilostest.py ..                                                                                                                              [ 42%]
beartype_test/a00_unit/a20_util/os/test_utilostty.py .                                                                                                                                [ 43%]
beartype_test/a00_unit/a20_util/py/test_utilpyinterpreter.py ....                                                                                                                     [ 44%]
beartype_test/a00_unit/a20_util/py/test_utilpyweakref.py ..                                                                                                                           [ 44%]
beartype_test/a00_unit/a20_util/py/test_utilpyword.py .                                                                                                                               [ 45%]
beartype_test/a00_unit/a20_util/test_utilobject.py ....                                                                                                                               [ 46%]
beartype_test/a00_unit/a20_util/text/test_utiltextansi.py ..                                                                                                                          [ 46%]
beartype_test/a00_unit/a20_util/text/test_utiltextidentifier.py ..                                                                                                                    [ 47%]
beartype_test/a00_unit/a20_util/text/test_utiltextjoin.py ..                                                                                                                          [ 47%]
beartype_test/a00_unit/a20_util/text/test_utiltextlabel.py ...                                                                                                                        [ 48%]
beartype_test/a00_unit/a20_util/text/test_utiltextmunge.py .....                                                                                                                      [ 50%]
beartype_test/a00_unit/a20_util/text/test_utiltextrepr.py ..                                                                                                                          [ 50%]
beartype_test/a00_unit/a20_util/text/test_utiltextversion.py .                                                                                                                        [ 51%]
beartype_test/a00_unit/a40_api/conf/test_confcls.py ..                                                                                                                                [ 51%]
beartype_test/a00_unit/a40_api/conf/test_confenum.py ..                                                                                                                               [ 52%]
beartype_test/a00_unit/a40_api/conf/test_confoverrides.py .                                                                                                                           [ 52%]
beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py .............                                                                                                      [ 56%]
beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py .                                                                                                                      [ 56%]
beartype_test/a00_unit/a40_api/plug/test_plugmixin.py .                                                                                                                               [ 56%]
beartype_test/a00_unit/a40_api/test_api_cave.py .....                                                                                                                                 [ 58%]
beartype_test/a00_unit/a40_api/test_api_meta.py .                                                                                                                                     [ 58%]
beartype_test/a00_unit/a40_api/typing/test_typingpep544.py ........                                                                                                                   [ 61%]
beartype_test/a00_unit/a40_api/vale/_core/test_valecore.py ..                                                                                                                         [ 61%]
beartype_test/a00_unit/a40_api/vale/_is/test_valeis.py ...                                                                                                                            [ 62%]
beartype_test/a00_unit/a40_api/vale/_is/test_valeiscls.py ....                                                                                                                        [ 63%]
beartype_test/a00_unit/a40_api/vale/_is/test_valeisobj.py ..                                                                                                                          [ 64%]
beartype_test/a00_unit/a40_api/vale/_is/test_valeisoper.py ..                                                                                                                         [ 64%]
beartype_test/a00_unit/a40_api/vale/_util/test_valeutiltext.py .                                                                                                                      [ 65%]
beartype_test/a00_unit/a60_check/a00_code/snip/test_codesnipcls.py .                                                                                                                  [ 65%]
beartype_test/a00_unit/a60_check/a00_code/test_codemake.py .                                                                                                                          [ 65%]
beartype_test/a00_unit/a60_check/a00_code/test_codescope.py ...                                                                                                                       [ 66%]
beartype_test/a00_unit/a60_check/a20_convert/test_convcoerce.py ..                                                                                                                    [ 67%]
beartype_test/a00_unit/a60_check/a20_convert/test_convreduce.py .                                                                                                                     [ 67%]
beartype_test/a00_unit/a60_check/a80_forward/reference/test_fwdrefmake.py .                                                                                                           [ 67%]
beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py .....                                                                                                                     [ 69%]
beartype_test/a00_unit/a60_check/a90_door/test_checkdoor_pep563.py .                                                                                                                  [ 69%]
beartype_test/a00_unit/a60_check/test_checkcall.py .                                                                                                                                  [ 69%]
beartype_test/a00_unit/a70_decor/a00_core/test_decormore.py .                                                                                                                         [ 70%]
beartype_test/a00_unit/a70_decor/a20_error/a90_main/test_errorget.py .....                                                                                                            [ 71%]
beartype_test/a00_unit/a70_decor/a20_error/a90_main/test_errorplug.py .                                                                                                               [ 71%]
beartype_test/a00_unit/a70_decor/a40_code/a00_module/test_decor_contextlib.py s                                                                                                       [ 72%]
beartype_test/a00_unit/a70_decor/a40_code/a00_module/test_decor_functools.py .                                                                                                        [ 72%]
beartype_test/a00_unit/a70_decor/a40_code/a00_module/test_decor_mypy.py .                                                                                                             [ 72%]
beartype_test/a00_unit/a70_decor/a40_code/a00_module/test_decor_nptyping.py s                                                                                                         [ 72%]
beartype_test/a00_unit/a70_decor/a40_code/a00_module/test_decor_pandera.py s                                                                                                          [ 73%]
beartype_test/a00_unit/a70_decor/a40_code/a80_nonpep/test_codenonpep.py .........                                                                                                     [ 75%]
beartype_test/a00_unit/a70_decor/a40_code/a90_pep/pep484/test_pep484.py .....                                                                                                         [ 77%]
beartype_test/a00_unit/a70_decor/a40_code/a90_pep/pep484/test_pep484ref.py .....                                                                                                      [ 78%]
beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep3119.py .                                                                                                              [ 79%]
beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep435663.py .s                                                                                                           [ 79%]
beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep484585.py ...                                                                                                          [ 80%]
beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep544.py ..                                                                                                              [ 81%]
beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep557.py .                                                                                                               [ 81%]
beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep563.py .....s...                                                                                                       [ 84%]
beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep585.py .                                                                                                               [ 84%]
beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep591.py .                                                                                                               [ 84%]
beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep613.py .                                                                                                               [ 84%]
beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep647.py .                                                                                                               [ 85%]
beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep673.py s                                                                                                               [ 85%]
beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep695.py s                                                                                                               [ 85%]
beartype_test/a00_unit/a70_decor/a40_code/test_codeargkind.py ..s......                                                                                                               [ 88%]
beartype_test/a00_unit/a70_decor/a40_code/test_codenoop.py .......                                                                                                                    [ 90%]
beartype_test/a00_unit/a70_decor/a40_code/test_codetype.py ...                                                                                                                        [ 91%]
beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py .                                                                                                                          [ 91%]
beartype_test/a00_unit/a70_decor/a80_conf/test_decorconf.py ...                                                                                                                       [ 92%]
beartype_test/a00_unit/a70_decor/a90_roar/test_beartype_roar.py ..                                                                                                                    [ 93%]
beartype_test/a00_unit/a70_decor/test_decorwrappee.py ......                                                                                                                          [ 94%]
beartype_test/a00_unit/a70_decor/test_decorwrapper.py .                                                                                                                               [ 95%]
beartype_test/a00_unit/a90_claw/a00_core/test_claw_api.py .                                                                                                                           [ 95%]
beartype_test/a00_unit/a90_claw/a90_hook/test_claw_extraprocess.py ..                                                                                                                 [ 95%]
beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py .....                                                                                                              [ 97%]
beartype_test/a90_func/doc/test_docreadme.py .                                                                                                                                        [ 97%]
beartype_test/a90_func/package/test_package_import.py .                                                                                                                               [ 97%]
beartype_test/a90_func/pep/test_pep561_static.py ..                                                                                                                                   [ 98%]
beartype_test/a90_func/z90_lib/a00_sphinx/test_sphinx.py ..                                                                                                                           [ 99%]
beartype_test/a90_func/z90_lib/a90_nuitka/test_nuitka.py s                                                                                                                            [ 99%]
beartype_test/a90_func/z90_lib/test_equinox.py s                                                                                                                                      [ 99%]
beartype_test/a90_func/z90_lib/test_torch.py s                                                                                                                                        [100%]

================================================================================== short test summary info ==================================================================================
SKIPPED [1] beartype_test/a00_unit/a70_decor/a40_code/a00_module/test_decor_contextlib.py:21: Python 3.10.14 < 3.11.0.
SKIPPED [1] beartype_test/a00_unit/a70_decor/a40_code/a00_module/test_decor_nptyping.py:30: could not import 'nptyping': No module named 'nptyping'
SKIPPED [1] beartype_test/a00_unit/a70_decor/a40_code/a00_module/test_decor_pandera.py:22: could not import 'pandera': No module named 'pandera'
SKIPPED [1] beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep435663.py:64: Python 3.10.14 < 3.11.0.
SKIPPED [1] beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep563.py:298: Python 3.10.14 >= 3.10.0.
SKIPPED [1] beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep673.py:21: Python 3.10.14 < 3.11.0.
SKIPPED [1] beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep695.py:21: Python 3.10.14 < 3.12.0.
SKIPPED [1] beartype_test/a00_unit/a70_decor/a40_code/test_codeargkind.py:80: Currently broken due to known issues in decoration-time type-checking.
SKIPPED [1] beartype_test/a90_func/z90_lib/a90_nuitka/test_nuitka.py:31: could not import 'nuitka': No module named 'nuitka'
SKIPPED [1] beartype_test/a90_func/z90_lib/test_equinox.py:21: could not import 'equinox': No module named 'equinox'
SKIPPED [1] beartype_test/a90_func/z90_lib/test_torch.py:21: could not import 'torch': No module named 'torch'
============================================================================= 333 passed, 11 skipped in 48.33s =======================================================================

.. magic 😄

@kloczek
Copy link
Author

kloczek commented Apr 15, 2024

BTW after all I've been trying to filter beartype all code using pyuprade --py38-plus and ruff check --diff --fix.
On testing booth patches pytest fails.
Only summary from those tests

pyupgrade
================================================================================== short test summary info ==================================================================================
SKIPPED [1] tests/test_env.py:35: workaround for Apple Python
SKIPPED [1] tests/test_env.py:46: workaround for Debian/Ubuntu Python
SKIPPED [45] tests/test_integration.py:70: integration tests not run (no --run-integration flag)
SKIPPED [1] tests/test_integration.py: integration tests not run (no --run-integration flag)
FAILED tests/test_env.py::test_default_pip_is_never_too_old[False] - build._exceptions.FailedProcessError: Failed to create venv. Maybe try installing virtualenv.
FAILED tests/test_env.py::test_pip_needs_upgrade_mac_os_11[False-x86_64-20.2.0] - build._exceptions.FailedProcessError: Failed to create venv. Maybe try installing virtualenv.
FAILED tests/test_env.py::test_pip_needs_upgrade_mac_os_11[False-x86_64-20.3.0] - build._exceptions.FailedProcessError: Failed to create venv. Maybe try installing virtualenv.
FAILED tests/test_env.py::test_pip_needs_upgrade_mac_os_11[False-x86_64-21.0.0] - build._exceptions.FailedProcessError: Failed to create venv. Maybe try installing virtualenv.
FAILED tests/test_env.py::test_pip_needs_upgrade_mac_os_11[False-x86_64-21.0.1] - build._exceptions.FailedProcessError: Failed to create venv. Maybe try installing virtualenv.
FAILED tests/test_env.py::test_pip_needs_upgrade_mac_os_11[False-arm64-20.2.0] - build._exceptions.FailedProcessError: Failed to create venv. Maybe try installing virtualenv.
FAILED tests/test_env.py::test_pip_needs_upgrade_mac_os_11[False-arm64-20.3.0] - build._exceptions.FailedProcessError: Failed to create venv. Maybe try installing virtualenv.
FAILED tests/test_env.py::test_pip_needs_upgrade_mac_os_11[False-arm64-21.0.0] - build._exceptions.FailedProcessError: Failed to create venv. Maybe try installing virtualenv.
FAILED tests/test_env.py::test_pip_needs_upgrade_mac_os_11[False-arm64-21.0.1] - build._exceptions.FailedProcessError: Failed to create venv. Maybe try installing virtualenv.
FAILED tests/test_env.py::test_default_impl_install_cmd_well_formed[False-0] - build._exceptions.FailedProcessError: Failed to create venv. Maybe try installing virtualenv.
FAILED tests/test_env.py::test_default_impl_install_cmd_well_formed[False-1] - build._exceptions.FailedProcessError: Failed to create venv. Maybe try installing virtualenv.
FAILED tests/test_env.py::test_default_impl_install_cmd_well_formed[False-2] - build._exceptions.FailedProcessError: Failed to create venv. Maybe try installing virtualenv.
FAILED tests/test_env.py::test_default_impl_install_cmd_well_formed[False-3] - build._exceptions.FailedProcessError: Failed to create venv. Maybe try installing virtualenv.
FAILED tests/test_env.py::test_uv_impl_install_cmd_well_formed[False-0] - RuntimeError: uv executable not found
FAILED tests/test_env.py::test_uv_impl_install_cmd_well_formed[False-1] - RuntimeError: uv executable not found
FAILED tests/test_env.py::test_uv_impl_install_cmd_well_formed[False-2] - RuntimeError: uv executable not found
FAILED tests/test_env.py::test_uv_impl_install_cmd_well_formed[False-3] - RuntimeError: uv executable not found
FAILED tests/test_env.py::test_venv_creation[pip-venv+pip-False] - build._exceptions.FailedProcessError: Failed to create venv. Maybe try installing virtualenv.
FAILED tests/test_env.py::test_venv_creation[uv-venv+uv-None] - RuntimeError: uv executable not found
FAILED tests/test_env.py::test_external_uv_detection_success[False] - RuntimeError: uv executable not found
FAILED tests/test_main.py::test_output[False-via-sdist-no-isolation] - AssertionError: assert ['* Getting b...none-any.whl'] == ['* Getting b...none-any.whl']
FAILED tests/test_main.py::test_output[False-sdist-direct-no-isolation] - AssertionError: assert ['* Getting b...ols-1.tar.gz'] == ['* Getting b...1.0.0.tar.gz']
FAILED tests/test_main.py::test_output[False-sdist-and-wheel-direct-no-isolation] - AssertionError: assert ['* Getting b...none-any.whl'] == ['* Getting b...none-any.whl']
FAILED tests/test_main.py::test_output_env_subprocess_error[False-no-color] - AssertionError: assert ['* Creating ...dule_as_main'] == ['* Creating ...s is invalid']
FAILED tests/test_main.py::test_output_env_subprocess_error[False-color] - AssertionError: assert ['\x1b[1m* Cr..._main\x1b[0m'] == ['\x1b[1m* Cr...s is invalid']
=========================================================== 25 failed, 111 passed, 48 skipped, 12 deselected, 15 rerun in 38.19s ============================================================
ruff
================================================================================== short test summary info ==================================================================================
SKIPPED [1] beartype_test/a00_unit/a70_decor/a40_code/a00_module/test_decor_contextlib.py:21: Python 3.10.14 < 3.11.0.
SKIPPED [1] beartype_test/a00_unit/a70_decor/a40_code/a00_module/test_decor_nptyping.py:30: could not import 'nptyping': No module named 'nptyping'
SKIPPED [1] beartype_test/a00_unit/a70_decor/a40_code/a00_module/test_decor_pandera.py:22: could not import 'pandera': No module named 'pandera'
SKIPPED [1] beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep435663.py:64: Python 3.10.14 < 3.11.0.
SKIPPED [1] beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep563.py:298: Python 3.10.14 >= 3.10.0.
SKIPPED [1] beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep673.py:21: Python 3.10.14 < 3.11.0.
SKIPPED [1] beartype_test/a00_unit/a70_decor/a40_code/a90_pep/test_decorpep695.py:21: Python 3.10.14 < 3.12.0.
SKIPPED [1] beartype_test/a00_unit/a70_decor/a40_code/test_codeargkind.py:80: Currently broken due to known issues in decoration-time type-checking.
SKIPPED [1] beartype_test/a90_func/z90_lib/a90_nuitka/test_nuitka.py:31: could not import 'nuitka': No module named 'nuitka'
SKIPPED [1] beartype_test/a90_func/z90_lib/test_equinox.py:21: could not import 'equinox': No module named 'equinox'
SKIPPED [1] beartype_test/a90_func/z90_lib/test_torch.py:21: could not import 'torch': No module named 'torch'
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585callable.py::test_get_hint_pep484585_callable_params_and_return
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585generic.py::test_is_hint_pep484585_generic
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585generic.py::test_get_hint_pep484585_generic_type_or_none
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585generic.py::test_get_hint_pep484585_generic_bases_unerased
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_utilpep585.py::test_is_hint_pep585_builtin
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_utilpep585.py::test_is_hint_pep585_generic
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_utilpep585.py::test_get_hint_pep585_generic_typevars
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_args
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_typevars
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_typevars
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_typing
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_type_typing
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_args
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported
ERROR beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_die_unless_hint_nonpep
ERROR beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep
ERROR beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep_tuple
ERROR beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhintget.py::test_get_hint_repr
ERROR beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_die_unless_hint
ERROR beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint
ERROR beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint_ignorable
ERROR beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint_needs_cls_stack
ERROR beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_mapping
ERROR beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_equals
ERROR beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable
ERROR beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py::test_door_is_subhint
ERROR beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings
ERROR beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable
ERROR beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable
ERROR beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable
ERROR beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable
ERROR beartype_test/a00_unit/a70_decor/a40_code/test_codenoop.py::test_decor_noop_hint_ignorable_iter
ERROR beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype
ERROR beartype_test/a90_func/z90_lib/a00_sphinx/test_sphinx.py::test_sphinx_docs_these
FAILED beartype_test/a00_unit/a70_decor/a40_code/a90_pep/pep484/test_pep484ref.py::test_pep484_ref_data - beartype.roar.BeartypeCallHintForwardRefException: Forward reference "Type" unimportable from module "beartype_test.a00_unit.data.hint.data_hintref".
FAILED beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages - Failed: Test "test_claw_intraprocess_beartype_packages" failed in isolated subprocess with:
FAILED beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all - Failed: Test "test_claw_intraprocess_beartype_all" failed in isolated subprocess with:
FAILED beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping - Failed: Test "test_claw_intraprocess_beartyping" failed in isolated subprocess with:
FAILED beartype_test/a90_func/pep/test_pep561_static.py::test_pep561_mypy - subprocess.CalledProcessError: Command '('/usr/bin/python3', '-m', 'mypy', '--config-file', '/home/tkloczko/rpmbuild/BUILD/beartype-0.18.2/mypy.ini', '/home/tkloczko/rpmbuild/BUILD/bea...
=================================================================== 5 failed, 289 passed, 11 skipped, 39 errors in 34.11s ===================================================================
I'm not sure is it was possible to expose some bad behaviour of these tools on `beartype` code or maybe it is some issue with `beartype` code and/or it is possible to apply some changes in `beartype` to make ready code on use those tools? 🤔

Looking on the generated pyupgrade patch I think that at least some of those changes should be applied as beartype seems currently is supporting only python>=3.8 🤔

@leycec
Copy link
Member

leycec commented Apr 15, 2024

pyupgrade, huh? I'd actually never heard of that before, but... neat-o! That's a fascinating devtool. That sure is an extreme number of test failures too, isn't it? The bear feels more sad. I must confess that those test failures all appear to be unrelated to @beartype: e.g.,

build._exceptions.FailedProcessError: Failed to create venv. Maybe try installing virtualenv.

venv stuff, huh? Gods. I hate venv stuff.

RuntimeError: uv executable not found

uv stuff, huh? I don't even know what uv is. But I hate it already.

Google tells me:

The easiest way to create a UniVerse account is to create an empty UNIX directory, cd to it, and enter the 'uv' command to invoke UniVerse. The UniVerse bin directory contains its executable: if it is not on your path, you will have to enter the full path to the command: something like /universe/bin/uv.

And I'm like... "UniVerse"? What are you even talking about, Google? I already live in the Universe. I sure don't want that "V" being capitalized anymore than you do. 😆

And... even ruff fails now, huh? In theory, supporting yet another linter is trivial. In practice, @beartype already supports mypy and pyright and spends far too much mostly unpaid volunteer time doing so. If somebody who is not me would like to uselessly squander valuably invest a week or so on a PR resolving all ruff complaints in the @beartype codebase, that would be the chef's kiss. 😘

Sadly, I don't know if I have the intestinal fortitude to extend support to ruff at the moment. None of these linters or static type-checkers agree on anything. So, it's surprisingly non-trivial (and a continual migraine that never goes away) to extend support for yet another disagreeable linter or static type-checker. Also, I mostly hate all linters and static type-checkers. They waste my time! They waste so much of it, @kloczek!

Let's optimistically reopen this issue under a new name encouraging me to extend support to ruff. I sigh as you sigh. </sigh>

@leycec leycec reopened this Apr 15, 2024
@leycec leycec changed the title 0.18.2: pytest fails in beartype_test/a90_func/pep/test_pep561_static.py::test_pep561_pyright unit with pyright 1.1.358 [Feature Request] Add a new unit test linting the @beartype codebase with ruff 😮‍💨 Apr 15, 2024
@leycec leycec changed the title [Feature Request] Add a new unit test linting the @beartype codebase with ruff 😮‍💨 [Tests] Add a new unit test linting the @beartype codebase with ruff 😮‍💨 Apr 15, 2024
@kloczek
Copy link
Author

kloczek commented Apr 15, 2024

If you will spot any changes wrongly done by those linters please open the ticket in they repos.
I'm sure that for you it will be way easier to explain what those tools are done incorrectly 😋

@kloczek
Copy link
Author

kloczek commented Apr 15, 2024

ruff is un under kind of explosion of the development so sometimes it is better to drop them issue instead trying to fight with some issue alone. This tool is really powerful and it swallows quickly pylint, flake8 and few other and I'm sure that quite soon using it will be kind of standard de facto.

Readiness for pyupgrade is important from point of view of dropping older major python versions .. automatically day after EOS will reach its final date (this year in Jun will be EOSsed python 3.8).

@kloczek
Copy link
Author

kloczek commented Apr 18, 2024

Just started testing 0.18.3 and I see that now after apply patch pyupgrade --py38-plus pytest is OK.
The same after add second patch generated by pyupgrade --py38-plus causes few fails

FAILED beartype_test/a00_unit/a00_core/test_a90_typing.py::test_api_typing - AssertionError: assert <class 'collections.abc.Hashable'> is typing.Hashable
FAILED beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585generic.py::test_is_hint_pep484585_generic - AssertionError: assert False is (HintSign('Generic') is HintSign('Generic'))
FAILED beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585generic.py::test_get_hint_pep484585_generic_bases_unerased - beartype.roar.BeartypeDecorHintPep484585Exception: Type hint <class 'beartype_test.a00_unit.data.hint.pep.proposal.data_pep484._Pep484GenericUnsubscriptedSingle'> neither PEP 484 gener...
FAILED beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_utilpep585.py::test_is_hint_pep585_builtin - assert True is False
FAILED beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_utilpep585.py::test_is_hint_pep585_generic - AssertionError: assert True is False
FAILED beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_utilpep585.py::test_get_hint_pep585_generic_typevars - Failed: DID NOT RAISE <class 'beartype.roar.BeartypeDecorHintPep585Exception'>
FAILED beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign - beartype.roar.BeartypeDecorHintPepSignException: Type hint <class 'collections.abc.Hashable'> is PEP-noncompliant (e.g., neither isinstanceable class, forward reference, nor tuple of i...
FAILED beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable - beartype.roar.BeartypeDecorHintPepException: Type hint <class 'collections.abc.Hashable'> not isinstanceable (i.e., does not originate from isinstanceable class).
FAILED beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none - AssertionError: assert None is <class 'collections.abc.Hashable'>
FAILED beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_typing - AssertionError: assert False is True
FAILED beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_type_typing - AssertionError: assert False is True
FAILED beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep - AssertionError: assert False is True
FAILED beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported - AssertionError: assert False is True
FAILED beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported - beartype.roar.BeartypeDecorHintPepException: Type hint <class 'collections.abc.Hashable'> not PEP-compliant.
FAILED beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_die_unless_hint_nonpep - Failed: DID NOT RAISE <class 'beartype.roar.BeartypeDecorHintNonpepException'>
FAILED beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep - AssertionError: assert True is False
FAILED beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_new - AssertionError: assert ClassTypeHint(<class 'list'>) is not ClassTypeHint(<class 'list'>)
FAILED beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings - Failed: DID NOT WARN. No warnings of type (<class 'beartype.roar._roarwarn.BeartypeDecorHintPep585DeprecationWarning'>,) were emitted.

Use generated by ruff check --diff --fix causes that pytest is not able to find fixture and few other issues

___________________________________________________________ ERROR at setup of test_get_hint_pep484585_callable_params_and_return ____________________________________________________________
file /home/tkloczko/rpmbuild/BUILD/beartype-0.18.3/beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585callable.py, line 21
  def test_get_hint_pep484585_callable_params_and_return(hints_pep_meta) -> None:
E       fixture 'hints_pep_meta' not found
>       available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
>       use 'pytest --fixtures [testpath]' for help on them.

/home/tkloczko/rpmbuild/BUILD/beartype-0.18.3/beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585callable.py:21

[..]

ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585callable.py::test_get_hint_pep484585_callable_params_and_return
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585generic.py::test_is_hint_pep484585_generic
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585generic.py::test_get_hint_pep484585_generic_type_or_none
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/pep484585/test_utilpep484585generic.py::test_get_hint_pep484585_generic_bases_unerased
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_utilpep585.py::test_is_hint_pep585_builtin
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_utilpep585.py::test_is_hint_pep585_generic
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/proposal/test_utilpep585.py::test_get_hint_pep585_generic_typevars
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_args
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_typevars
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_sign
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/test_a00_utilpepget.py::test_get_hint_pep_type_isinstanceable_or_none
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_typevars
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_typing
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_type_typing
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_args
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_is_hint_pep_supported
ERROR beartype_test/a00_unit/a20_util/hint/a00_pep/test_a90_utilpeptest.py::test_die_if_hint_pep_unsupported
ERROR beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_die_unless_hint_nonpep
ERROR beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep
ERROR beartype_test/a00_unit/a20_util/hint/a10_nonpep/test_utilhintnonpeptest.py::test_is_hint_nonpep_tuple
ERROR beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhintget.py::test_get_hint_repr
ERROR beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_die_unless_hint
ERROR beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint
ERROR beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint_ignorable
ERROR beartype_test/a00_unit/a20_util/hint/a90_core/test_utilhinttest.py::test_is_hint_needs_cls_stack
ERROR beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_mapping
ERROR beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_equals
ERROR beartype_test/a00_unit/a40_api/door/a00_type/test_door_typehint.py::test_door_typehint_is_ignorable
ERROR beartype_test/a00_unit/a40_api/door/a90_func/test_door_func.py::test_door_is_subhint
ERROR beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable_warnings
ERROR beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_die_if_unbearable
ERROR beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_die_if_unbearable
ERROR beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_is_bearable
ERROR beartype_test/a00_unit/a60_check/a90_door/test_checkdoor.py::test_door_typehint_is_bearable
ERROR beartype_test/a00_unit/a70_decor/a40_code/test_codenoop.py::test_decor_noop_hint_ignorable_iter
ERROR beartype_test/a00_unit/a70_decor/a60_main/test_beartype.py::test_beartype
FAILED beartype_test/a00_unit/a70_decor/a40_code/a90_pep/pep484/test_pep484ref.py::test_pep484_ref_data - beartype.roar.BeartypeCallHintForwardRefException: Forward reference "Type" unimportable from module "beartype_test.a00_unit.data.hint.data_hintref".
FAILED beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_packages - Failed: Test "test_claw_intraprocess_beartype_packages" failed in isolated subprocess with:
FAILED beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartype_all - Failed: Test "test_claw_intraprocess_beartype_all" failed in isolated subprocess with:
FAILED beartype_test/a00_unit/a90_claw/a90_hook/test_claw_intraprocess.py::test_claw_intraprocess_beartyping - Failed: Test "test_claw_intraprocess_beartyping" failed in isolated subprocess with:
FAILED beartype_test/a90_func/pep/test_pep561_static.py::test_pep561_mypy - subprocess.CalledProcessError: Command '('/usr/bin/python3', '-m', 'mypy', '--config-file', '/home/tkloczko/rpmbuild/BUILD/beartype-0.18.3/mypy.ini', '/home/tkloczko/rpmbuild/BUILD/bea...

@leycec
Copy link
Member

leycec commented Apr 23, 2024

If you will spot any changes wrongly done by those linters please open the ticket in they repos.

Bro... static type-checkers and linters are wrong about almost everything. If I had to open an upstream ticket every time a static type-checker or linter failed to statically analyze Python, I'd never do anything except that. So, I don't do that. Nobody does that. We just forcefully silence static type-checkers and linters with:

  • Inline pragmas like # type: ignore (for mypy) or # pyright: ignore (for pyright).
  • Command-line options like --disable=R,C,E0401,E0603,E0611,E0702,E1101,E1133,E1135,E1136,W0107,W0122,W0123,W0201,W0212,W0221,W0511,W0603,W0613,W0632,W0702,W0703 (for pylint).

That's sorta okay, because we expect static type-checkers and linters to be wrong about almost everything. By definition, you cannot statically analyse (i.e., semantically parse) dynamically interpreted languages like Python and Ruby. Seriously. It's infeasible – both in theory and in practice. In excess of 90% of all "errors" from static type-checkers and linters are just false negatives induced by a fundamental mismatch between static analysis and dynamic typing.

This is why increasingly many lines in the @beartype codebase are suffixed by # type: ignore and # pyright: ignore and why I lint @beartype with pylint --disable=R,C,E0401,E0603,E0611,E0702,E1101,E1133,E1135,E1136,W0107,W0122,W0123,W0201,W0212,W0221,W0511,W0603,W0613,W0632,W0702,W0703. Right? Static type-checkers and linters are unable to statically analyze Python reliably. We have to tell them to ignore lines that cannot be statically analyzed reliably.

It sucks. It's just the nature of the beast, though. It's intrinsic to Python. That's why @beartype exists, after all. Nobody statically analyzes Python to any degree of accuracy. Instead, everyone runtime analyzes Python. Thus the bear flexes. 💪 🐻

Use generated by ruff check --diff --fix causes that pytest is not able to find fixture and few other issues

...heh. You're linting the @beartype test suite with ruff, huh? That's fascinating, but really low priority. Tests currently pass both locally and on GitHub Actions-based continuous integration (CI) across all supported platforms and Python versions. Thus, we have casually verified that ruff has no idea what it is talking about.

Seriously. Clearly, pytest is able to find all requisite fixtures. Right? Otherwise tests wouldn't pass. But tests pass. In fact, the fixture that ruff is complaining about is trivially imported by the beartype_test.a00_unit.conftest plugin, whose contents are:

#!/usr/bin/env python3
# --------------------( LICENSE                            )--------------------
# Copyright (c) 2014-2024 Beartype authors.
# See "LICENSE" for further details.


'''
**Test configuration** (i.e., :mod:`pytest`-specific early-time configuration
guaranteed to be implicitly imported by :mod:`pytest` into *all* sibling and
child submodules of the test subpackage containing this :mod:`pytest` plugin).
'''

# ....................{ IMPORTS                            }....................
# Import all subpackage-specific fixtures implicitly required by tests defined
# by submodules of this subpackage.
from beartype_test.a00_unit.data.hint.data_hint import (
    hints_meta,
    hints_ignorable,
    not_hints_nonpep,
)
from beartype_test.a00_unit.data.hint.nonpep.data_nonpep import (
    hints_nonpep_meta,
)
from beartype_test.a00_unit.data.hint.pep.data_pep import (
    hints_pep_hashable,
    hints_pep_ignorable_deep,
    hints_pep_ignorable_shallow,
    hints_pep_meta,
)
from beartype_test.a00_unit.data.hint.util.data_hintmetautil import (
    iter_hints_piths_meta,
)

Kinda seems like running pytest under ruff fundamentally destroys pytest by preventing conftest submodules from being executed as pytest plugins, doesn't it? My advice is thus simple: please stop running pytest under ruff. What you're trying to do isn't working – but not because @beartype did something wrong. @beartype is fine. It's ruff that's not fine in this case.

That said, even if ruff was fine, linting the @beartype test suite doesn't particularly make sense. The test suite is just a means to an ends; it's not the ends. The ends is the main @beartype codebase. The @beartype test suite was never intended to be linted, statically analyzed, or otherwise parsed. The @beartype test suite just exists to run tests. That's it. Linting and statically analyzing tests that already pass mostly just seems like an exercise in futility and squandering scarce open-source volunteerism to me.

Ultimately, it's only the main @beartype codebase that matters – and it's only the main @beartype codebase that should be linted and statically analyzed. Of course, this is merely my subjective opinion. I may very well be objectively wrong. I probably am. But there are only so many hours in the day. As I age, my days are dwindling. Linting test suites definitely isn't how I want to spend the remainder of my years on Planet Earth.

If you'd like to lint the @beartype test suite for me, awesome! I'll happily merge anything that passes. Otherwise, linting the @beartype test suite will probably never happen. You know. Just sayin'. If you keep your expectations low, you'll never be disappointed. 😹

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants