Skip to content

0.3.0: pytest is failing in tests/test_api.py::test_signature unit #19

Open
@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> 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-pypi-json-0.3.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-pypi-json-0.3.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network'
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.8.16, pytest-7.3.1, pluggy-1.0.0
Test session started at 14:47:39
rootdir: /home/tkloczko/rpmbuild/BUILD/pypi-json-0.3.0
configfile: tox.ini
plugins: datadir-1.4.1, regressions-2.4.2, timeout-2.1.0, betamax-0.8.1
timeout: 300.0s
timeout method: signal
timeout func_only: False
collected 23 items

tests/test_api.py .....................F.                                                                                                                                             [100%]

========================================================================================= FAILURES ==========================================================================================
______________________________________________________________________________________ test_signature _______________________________________________________________________________________

    def test_signature():
        expected = "https://files.pythonhosted.org/packages/0a/6e/dd532144bcaf242417f9bacccdc0e1901e0d06e3367826193c84ea7a347b/build-0.6.0-py3-none-any.whl.asc"

        with PyPIJSON() as client:
                metadata = client.get_metadata("build", "0.6.0")
>               assert metadata.urls[0]["has_sig"]
E     assert False

tests/test_api.py:243: AssertionError
=================================================================================== slowest 25 durations ====================================================================================
0.29s call     tests/test_api.py::test_changes_to_api_july_2022
0.18s call     tests/test_api.py::test_signature
0.17s call     tests/test_api.py::test_download_file
0.04s call     tests/test_api.py::test_get_wheel_tag_mapping[numpy]
0.04s call     tests/test_api.py::test_get_wheel_tag_mapping[coverage]
0.04s call     tests/test_api.py::test_get_metadata
0.03s call     tests/test_api.py::test_get_latest_version
0.02s call     tests/test_api.py::test_get_wheel_tag_mapping[scipy]
0.02s setup    tests/test_api.py::test_get_metadata
0.02s call     tests/test_api.py::test_get_wheel_tag_mapping[pyyaml]
0.01s setup    tests/test_api.py::test_get_pypi_releases[None]
0.01s call     tests/test_api.py::test_get_wheel_tag_mapping[domdf_python_tools]
0.01s setup    tests/test_api.py::test_get_pypi_releases[0.1.0]
0.01s setup    tests/test_api.py::test_get_releases_with_digests[0.1.0]
0.01s setup    tests/test_api.py::test_get_releases_with_digests[None]
0.01s setup    tests/test_api.py::test_get_wheel_tag_mapping[numpy]
0.01s call     tests/test_api.py::test_get_wheel_tag_mapping[mathematical]
0.01s call     tests/test_api.py::test_get_wheel_tag_mapping[shippinglabel]
0.01s setup    tests/test_api.py::test_get_wheel_tag_mapping[domdf_python_tools]
0.01s setup    tests/test_api.py::test_get_wheel_tag_mapping[mathematical]
0.01s setup    tests/test_api.py::test_get_wheel_tag_mapping[coverage]
0.01s call     tests/test_api.py::test_metadata_nonexistant
0.01s setup    tests/test_api.py::test_get_wheel_tag_mapping[shippinglabel]

(2 durations < 0.005s hidden.  Use -vv to show these durations.)
================================================================================== short test summary info ==================================================================================
FAILED tests/test_api.py::test_signature - assert False
=============================================================================== 1 failed, 22 passed in 1.20s ================================================================================

Here is list of installed modules in build env

Package                       Version
----------------------------- ---------
alabaster                     0.7.13
apeye                         1.4.0
apeye-core                    1.1.3
asttokens                     2.2.1
attrs                         23.1.0
autodocsumm                   0.2.11
Babel                         2.12.1
backcall                      0.2.0
beautifulsoup4                4.12.2
betamax                       0.8.1
build                         0.10.0
CacheControl                  0.13.0
charset-normalizer            3.1.0
click                         8.1.3
coincidence                   0.6.5
consolekit                    1.4.1
cssutils                      2.6.0
decorator                     5.1.1
default-values                0.5.2
deprecation                   2.1.0
deprecation-alias             0.3.2
dict2css                      0.3.0
dist-meta                     0.8.0
distro                        1.8.0
docutils                      0.19
dom_toml                      0.6.1
domdf-python-tools            3.6.1
exceptiongroup                1.1.1
executing                     1.2.0
extras-require                0.5.0
filelock                      3.12.0
gpg                           1.20.0
handy-archives                0.1.2
html-section                  0.3.0
html5lib                      1.1
idna                          3.4
imagesize                     1.4.1
importlib-metadata            6.6.0
iniconfig                     2.0.0
installer                     0.7.0
ipython                       8.12.0
jedi                          0.18.2
Jinja2                        3.1.2
libcomps                      0.1.19
lockfile                      0.12.2
MarkupSafe                    2.1.2
matplotlib-inline             0.1.6
mistletoe                     1.0.1
msgpack                       1.0.5
natsort                       8.3.1
packaging                     23.1
parso                         0.8.3
pexpect                       4.8.0
pickleshare                   0.7.5
platformdirs                  3.5.1
pluggy                        1.0.0
prompt-toolkit                3.0.38
ptyprocess                    0.7.0
pure-eval                     0.2.2
pychoosealicense              2023.4.25
Pygments                      2.15.1
pypi-json                     0.3.0
pyproject_hooks               1.0.0
pyproject-parser              0.9.0
pytest                        7.3.1
pytest-datadir                1.4.1
pytest-regressions            2.4.2
pytest-timeout                2.1.0
python-dateutil               2.8.2
python-frontmatter            1.0.0
pytz                          2023.2
PyYAML                        6.0
requests                      2.30.0
ruamel.yaml                   0.17.26
ruamel.yaml.clib              0.2.7
seed-intersphinx-mapping      1.2.1
setuptools                    67.7.2
shippinglabel                 1.5.0
six                           1.16.0
snowballstemmer               2.2.0
soupsieve                     2.4.1
Sphinx                        6.2.1
sphinx_autodoc_typehints      1.22.0
sphinx-copybutton             0.5.1
sphinx-debuginfo              0.2.2
sphinx-jinja2-compat          0.2.0
sphinx-licenseinfo            0.3.1
sphinx-notfound-page          0.8.3
sphinx-prompt                 1.6.0
sphinx-pyproject              0.1.0
sphinx-tabs                   3.4.1
sphinx-toolbox                3.4.0
sphinxcontrib-applehelp       1.0.4
sphinxcontrib-devhelp         1.0.2
sphinxcontrib-htmlhelp        2.0.0
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.3
sphinxcontrib-serializinghtml 1.1.5
sphinxemoji                   0.2.0
stack-data                    0.6.2
tabulate                      0.9.0
toctree-plus                  0.6.0
toml                          0.10.2
tomli                         2.0.1
traitlets                     5.9.0
typing_extensions             4.5.0
urllib3                       1.26.15
wcwidth                       0.2.6
webencodings                  0.5.1
wheel                         0.40.0
whey                          0.0.24
zipp                          3.15.0

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingstale

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions