Skip to content

3.4.5: pytest is failing in mypy units #37

@kloczek

Description

@kloczek

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>
  • run pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>

Here is pytest output:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-utils-3.4.5-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-utils-3.4.5-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.15, pytest-7.2.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/python-utils-3.4.5, configfile: pytest.ini
plugins: asyncio-0.20.2, mypy-0.10.2
asyncio: mode=strict
collected 72 items

setup.py FF                                                                                                                                                          [  2%]
_python_utils_tests/__init__.py .                                                                                                                                    [  4%]
_python_utils_tests/test_decorators.py ...                                                                                                                           [  8%]
_python_utils_tests/test_generators.py .....                                                                                                                         [ 15%]
_python_utils_tests/test_import.py .......                                                                                                                           [ 25%]
_python_utils_tests/test_logger.py ..                                                                                                                                [ 27%]
_python_utils_tests/test_python_utils.py ..                                                                                                                          [ 30%]
_python_utils_tests/test_time.py ............                                                                                                                        [ 47%]
docs/conf.py .                                                                                                                                                       [ 48%]
python_utils/__init__.py .                                                                                                                                           [ 50%]
python_utils/__about__.py .                                                                                                                                          [ 51%]
python_utils/aio.py .                                                                                                                                                [ 52%]
python_utils/compat.py .                                                                                                                                             [ 54%]
python_utils/containers.py ...                                                                                                                                       [ 58%]
python_utils/converters.py .......                                                                                                                                   [ 68%]
python_utils/decorators.py ....                                                                                                                                      [ 73%]
python_utils/exceptions.py ..                                                                                                                                        [ 76%]
python_utils/formatters.py ....                                                                                                                                      [ 81%]
python_utils/generators.py .                                                                                                                                         [ 83%]
python_utils/import_.py .                                                                                                                                            [ 84%]
python_utils/logger.py ...                                                                                                                                           [ 88%]
python_utils/loguru.py F                                                                                                                                             [ 90%]
python_utils/terminal.py .                                                                                                                                           [ 91%]
python_utils/time.py .....                                                                                                                                           [ 98%]
python_utils/types.py F                                                                                                                                              [100%]

================================================================================= FAILURES =================================================================================
_________________________________________________________________________________ setup.py _________________________________________________________________________________
4: error: Skipping analyzing "setuptools": module is installed, but missing library stubs or py.typed marker  [import]
4: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
_______________________________________________________________________________ test session _______________________________________________________________________________
mypy exited with status 1.
__________________________________________________________________________ python_utils/loguru.py __________________________________________________________________________
14: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
__________________________________________________________________________ python_utils/types.py ___________________________________________________________________________
36: error: Function "Type[Pattern[Any]]" could always be true in boolean context  [truthy-function]
=================================================================================== mypy ===================================================================================
Found 2 errors in 2 files (checked 25 source files)
========================================================================= short test summary info ==========================================================================
FAILED setup.py::mypy
FAILED setup.py::mypy-status
FAILED python_utils/loguru.py::mypy
FAILED python_utils/types.py::mypy
====================================================================== 4 failed, 68 passed in 50.08s =======================================================================

Here is list of installed modules in build env

Package                       Version
----------------------------- -----------------
alabaster                     0.7.12
appdirs                       1.4.4
attrs                         22.1.0
Babel                         2.11.0
Brlapi                        0.8.3
build                         0.9.0
charset-normalizer            3.0.1
contourpy                     1.0.6
cssselect                     1.1.0
cycler                        0.11.0
distro                        1.8.0
dnspython                     2.2.1
docutils                      0.19
exceptiongroup                1.0.0
extras                        1.0.0
filelock                      3.8.0
fixtures                      4.0.0
fonttools                     4.38.0
gpg                           1.17.1-unknown
idna                          3.4
imagesize                     1.4.1
importlib-metadata            5.1.0
iniconfig                     1.1.1
Jinja2                        3.1.2
kiwisolver                    1.4.4
libcomps                      0.1.19
loguru                        0.6.0
louis                         3.23.0
lxml                          4.9.1
MarkupSafe                    2.1.1
matplotlib                    3.6.2
mypy                          0.990
mypy-extensions               0.4.3
numpy                         1.23.1
olefile                       0.46
packaging                     21.3
pbr                           5.9.0
pep517                        0.13.0
Pillow                        9.3.0
pip                           22.3.1
pluggy                        1.0.0
Pygments                      2.13.0
PyGObject                     3.42.2
pyparsing                     3.0.9
pytest                        7.2.0
pytest-asyncio                0.20.2
pytest-mypy                   0.10.2
pytest-runner                 6.0.0
python-dateutil               2.8.2
pytz                          2022.4
requests                      2.28.1
rpm                           4.17.0
scour                         0.38.2
setuptools                    65.6.3
six                           1.16.0
snowballstemmer               2.2.0
Sphinx                        5.3.0
sphinxcontrib-applehelp       1.0.2.dev20221204
sphinxcontrib-devhelp         1.0.2.dev20221204
sphinxcontrib-htmlhelp        2.0.0
sphinxcontrib-jsmath          1.0.1.dev20221204
sphinxcontrib-qthelp          1.0.3.dev20221204
sphinxcontrib-serializinghtml 1.1.5
testtools                     2.5.0
tomli                         2.0.1
typing_extensions             4.4.0
urllib3                       1.26.12
wheel                         0.38.4
zipp                          3.11.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions