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

5.4.0: pytest is failing in importlib_resources/tests/update-zips.py::importlib_resources.tests.update-zips.main unit #243

Closed
kloczek opened this issue Jan 4, 2022 · 1 comment

Comments

@kloczek
Copy link

kloczek commented Jan 4, 2022

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

Here is pytest with failing unit:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-importlib_resources-5.4.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-importlib_resources-5.4.0-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/importlib_resources-5.4.0, configfile: pytest.ini
collected 156 items

importlib_resources/tests/test_compatibilty_files.py ................                                                                                                [ 10%]
importlib_resources/tests/test_contents.py ...                                                                                                                       [ 12%]
importlib_resources/tests/test_files.py .........                                                                                                                    [ 17%]
importlib_resources/tests/test_open.py ......................................                                                                                        [ 42%]
importlib_resources/tests/test_path.py ...............                                                                                                               [ 51%]
importlib_resources/tests/test_read.py ..................................                                                                                            [ 73%]
importlib_resources/tests/test_reader.py .............                                                                                                               [ 82%]
importlib_resources/tests/test_resource.py ................s..........                                                                                               [ 99%]
importlib_resources/tests/update-zips.py F                                                                                                                           [100%]

================================================================================= FAILURES =================================================================================
___________________________________________________________ [doctest] importlib_resources.tests.update-zips.main ___________________________________________________________
018
019     >>> from unittest import mock
020     >>> monkeypatch = getfixture('monkeypatch')
021     >>> monkeypatch.setattr(zipfile, 'ZipFile', mock.MagicMock())
022     >>> print(); main()  # print workaround for bpo-32509
UNEXPECTED EXCEPTION: ValueError('list.remove(x): x not in list')
Traceback (most recent call last):
  File "/usr/lib64/python3.8/doctest.py", line 1336, in __run
    exec(compile(example.source, filename, "single",
  File "<doctest importlib_resources.tests.update-zips.main[3]>", line 1, in <module>
  File "/home/tkloczko/rpmbuild/BUILD/importlib_resources-5.4.0/importlib_resources/tests/update-zips.py", line 30, in main
    tuple(map(generate, suffixes))
  File "/home/tkloczko/rpmbuild/BUILD/importlib_resources-5.4.0/importlib_resources/tests/update-zips.py", line 37, in generate
    for src, rel in walk(root / f'data{suffix}'):
  File "/home/tkloczko/rpmbuild/BUILD/importlib_resources-5.4.0/importlib_resources/tests/update-zips.py", line 46, in walk
    dirnames.remove('__pycache__')
ValueError: list.remove(x): x not in list
/home/tkloczko/rpmbuild/BUILD/importlib_resources-5.4.0/importlib_resources/tests/update-zips.py:22: UnexpectedException
========================================================================= short test summary info ==========================================================================
SKIPPED [1] importlib_resources/tests/test_resource.py:185: Desired but not supported.
FAILED importlib_resources/tests/update-zips.py::importlib_resources.tests.update-zips.main
================================================================= 1 failed, 154 passed, 1 skipped in 0.52s =================================================================
@jaraco jaraco closed this as completed in b0968d5 Feb 11, 2022
@kloczek
Copy link
Author

kloczek commented Apr 17, 2022

Tested 5.7.0 and ItWorksNow™️

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-importlib_resources-5.7.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-importlib_resources-5.7.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.1, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/importlib_resources-5.7.0, configfile: pytest.ini
collected 156 items

importlib_resources/tests/test_compatibilty_files.py ................                                                                                                [ 10%]
importlib_resources/tests/test_contents.py ...                                                                                                                       [ 12%]
importlib_resources/tests/test_files.py .........                                                                                                                    [ 17%]
importlib_resources/tests/test_open.py ......................................                                                                                        [ 42%]
importlib_resources/tests/test_path.py ...............                                                                                                               [ 51%]
importlib_resources/tests/test_read.py ..................................                                                                                            [ 73%]
importlib_resources/tests/test_reader.py .............                                                                                                               [ 82%]
importlib_resources/tests/test_resource.py ................s..........                                                                                               [ 99%]
importlib_resources/tests/update-zips.py .                                                                                                                           [100%]

========================================================================= short test summary info ==========================================================================
SKIPPED [1] importlib_resources/tests/test_resource.py:185: Desired but not supported.
====================================================================== 155 passed, 1 skipped in 0.42s ======================================================================

Thank you 😃

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

1 participant