Skip to content

2.27.1: pytest is failing in tests/test_utils.py::TestExtractZippedPaths::test_zipped_paths_extracted unit #6034

@kloczek

Description

@kloczek

I'm trying to package 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
  • install .whl file in </install/prefix>
  • run pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>

Expected Result

pytest should should be running without fails or errors.

Actual Result

Looks like pytest is failing in tests/test_utils.py::TestExtractZippedPaths::test_zipped_paths_extracted unit

Here is pytest output:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-requests-2.27.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-requests-2.27.1-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/requests-2.27.1, configfile: pytest.ini
plugins: httpbin-1.0.1, mock-3.6.1
collected 559 items

tests/test_help.py ...                                                                                                                                               [  0%]
tests/test_hooks.py ...                                                                                                                                              [  1%]
tests/test_lowlevel.py ...................                                                                                                                           [  4%]
tests/test_packages.py ...                                                                                                                                           [  5%]
tests/test_requests.py ..............................................................................................................pytest-httpbin server hit an exception serving request: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:1131)
.attempting to ignore so the rest of the tests can run
.............................. [ 30%]
...........................................................x.....................................................................................                    [ 56%]
tests/test_structures.py ....................                                                                                                                        [ 59%]
tests/test_testserver.py ......s....                                                                                                                                 [ 61%]
tests/test_utils.py ..s............................................................................F................................................................ [ 87%]
.......................................................ssssssssss.....                                                                                               [100%]

================================================================================= FAILURES =================================================================================
____________________________________________________________ TestExtractZippedPaths.test_zipped_paths_extracted ____________________________________________________________

self = <tests.test_utils.TestExtractZippedPaths object at 0x7fb1f4f46250>, tmpdir = local('/tmp/pytest-of-tkloczko/pytest-632/test_zipped_paths_extracted0')

    def test_zipped_paths_extracted(self, tmpdir):
        zipped_py = tmpdir.join('test.zip')
        with zipfile.ZipFile(zipped_py.strpath, 'w') as f:
            f.write(__file__)

        _, name = os.path.splitdrive(__file__)
        zipped_path = os.path.join(zipped_py.strpath, name.lstrip(r'\/'))
        extracted_path = extract_zipped_paths(zipped_path)

        assert extracted_path != zipped_path
        assert os.path.exists(extracted_path)
>       assert filecmp.cmp(extracted_path, __file__)
E       AssertionError: assert False
E        +  where False = <function cmp at 0x7fb1f4ca65e0>('/tmp/test_utils.py', '/home/tkloczko/rpmbuild/BUILD/requests-2.27.1/tests/test_utils.py')
E        +    where <function cmp at 0x7fb1f4ca65e0> = filecmp.cmp

tests/test_utils.py:299: AssertionError
========================================================================= short test summary info ==========================================================================
SKIPPED [1] tests/test_testserver.py:95: this fails non-deterministically under pytest-xdist
SKIPPED [1] tests/test_utils.py:33: condition: cStringIO is None
SKIPPED [10] tests/test_utils.py:731: Test only on Windows
XFAIL tests/test_requests.py::TestRequests::test_response_iter_lines_reentrant
FAILED tests/test_utils.py::TestExtractZippedPaths::test_zipped_paths_extracted - AssertionError: assert False
===================================================== 1 failed, 545 passed, 12 skipped, 1 xfailed in 66.84s (0:01:06) ======================================================

List modules installed in build env:

Package                       Version
----------------------------- -------------------
alabaster                     0.7.12
appdirs                       1.4.4
attrs                         21.4.0
Babel                         2.9.1
blinker                       1.4
Brotli                        1.0.9
build                         0.7.0
cffi                          1.15.0
chardet                       4.0.0
charset-normalizer            2.0.10
click                         8.0.3
cryptography                  36.0.1
cycler                        0.11.0
dbus-python                   1.2.18
decorator                     5.1.0
distro                        1.6.0
docutils                      0.17.1
extras                        1.0.0
fixtures                      3.0.0
Flask                         2.0.2
fonttools                     4.28.5
gpg                           1.16.0-unknown
httpbin                       0.7.0
idna                          3.3
imagesize                     1.3.0
importlib-metadata            4.10.0
iniconfig                     1.1.1
itsdangerous                  2.0.1
Jinja2                        3.0.3
kiwisolver                    1.3.2
libcomps                      0.1.18
lit                           13.0.0
lxml                          4.7.1
Mako                          1.1.6.dev0
Markdown                      3.3.6
MarkupSafe                    2.0.1
matplotlib                    3.5.1
meson                         0.60.3
numpy                         1.22.0
olefile                       0.46
packaging                     21.3
pbr                           5.8.0
pep517                        0.12.0
Pillow                        9.0.0
pip                           21.3.1
pluggy                        1.0.0
ply                           3.11
py                            1.11.0
pycparser                     2.21
Pygments                      2.11.1
PyGObject                     3.42.0
pyparsing                     3.0.6
PySocks                       1.7.1
pytest                        6.2.5
pytest-httpbin                1.0.1
pytest-mock                   3.6.1
python-dateutil               2.8.2
pytz                          2021.1
raven                         6.10.0
requests                      2.26.0
rpm                           4.17.0
scour                         0.38.2
setuptools                    60.1.0.post20211225
six                           1.16.0
smartypants                   2.0.1
snowballstemmer               2.2.0
Sphinx                        4.3.2.dev20211231
sphinxcontrib-applehelp       1.0.2.dev20211227
sphinxcontrib-devhelp         1.0.2.dev20211228
sphinxcontrib-htmlhelp        2.0.0
sphinxcontrib-jsmath          1.0.1.dev20211227
sphinxcontrib-qthelp          1.0.3.dev20211227
sphinxcontrib-serializinghtml 1.1.5
testtools                     2.5.0
toml                          0.10.2
tomli                         2.0.0
trustme                       0.9.0
typogrify                     2.0.7
urllib3                       1.26.7
Werkzeug                      2.0.2
wheel                         0.37.1
zipp                          3.7.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions