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

3 failed tests on Alpine Linux #114

Closed
OTLabs opened this issue Nov 19, 2023 · 9 comments · Fixed by #133
Closed

3 failed tests on Alpine Linux #114

OTLabs opened this issue Nov 19, 2023 · 9 comments · Fixed by #133
Assignees
Labels
bug Something isn't working question Further information is requested
Milestone

Comments

@OTLabs
Copy link

OTLabs commented Nov 19, 2023

While building a package for Alpine Linux, musl, I got 3 failed tests:

=========================== short test summary info ============================
FAILED tests/i18n/test_i18n.py::test_selocale_unsupported - Failed: DID NOT RAISE <class 'locale.Error'>
FAILED tests/ogvjs/test_ogvjs.py::test_installed_script - FileNotFoundError: [Errno 2] No such file or directory: 'fix_ogvjs_dist'
FAILED tests/video/test_video.py::test_get_media_info[mp4-video.mp4-expected1] - AssertionError: assert {'bitrate': 3...'duration': 2} == {'bitrate': 3...'duration': 2}
  Omitting 2 identical items, use -vv to show
  Differing items:
  {'bitrate': 3837275} != {'bitrate': 3818365}
  Full diff:
  - {'bitrate': 3818365, 'codecs': ['h264', 'aac'], 'duration': 2}
  ?               -- ^
  + {'bitrate': 3837275, 'codecs': ['h264', 'aac'], 'duration': 2}
  ?                ^^^
================= 3 failed, 321 passed, 31 warnings in 59.12s ==================

How critical are these tests? Could I ignore them?

@rgaudin
Copy link
Member

rgaudin commented Nov 20, 2023

Those tests are not part of python libzim. Looks like python-scraperlib. I'll move the ticket but those are all environment related (version of ffmpeg installed, locales installed) so not critical

@kelson42 kelson42 added the bug Something isn't working label Dec 16, 2023
@kelson42 kelson42 added this to the 3.2.0 milestone Dec 16, 2023
@kelson42
Copy link
Contributor

How critical is that? Sounds blocking for Alpine packaging.

@kelson42 kelson42 added the question Further information is requested label Dec 16, 2023
@kelson42 kelson42 pinned this issue Dec 16, 2023
@rgaudin
Copy link
Member

rgaudin commented Dec 16, 2023

Will change the tests very soon ; this is happening on various platforms

@kelson42 kelson42 modified the milestones: 3.2.0, 3.2.1 Dec 16, 2023
@benoit74 benoit74 self-assigned this Dec 19, 2023
@benoit74
Copy link
Collaborator

benoit74 commented Feb 6, 2024

@rgaudin did you achieved to reproduce this on alpine? How?

I tried to start an alpine container but tests are failing due to a problem with libmagic linking - even if I installed it

Start container (from repo base folder):

docker run -it --rm -v $PWD:/src python:3.11-alpine /bin/sh

Inside container:

apk add libmagic
cd src
pip install -U pip tox
tox -e py311

Errors I get:

ERROR tests/filesystem/test_filesystem.py - AttributeError: Symbol not found: magic_open
ERROR tests/zim/test_archive.py - AttributeError: Symbol not found: magic_open
ERROR tests/zim/test_fs.py - AttributeError: Symbol not found: magic_open
ERROR tests/zim/test_zim_creator.py - AttributeError: Symbol not found: magic_open

@rgaudin
Copy link
Member

rgaudin commented Feb 6, 2024

I've already switched another project from file-magic to python-magic. Despite it being from the upstream team, they don't seem to put much effort in the binding. python-magic is better maintained IMO.

Just tested that it works fine on Alpine 👍

@benoit74
Copy link
Collaborator

I've made the transition to python-magic successfully, and it has indeed a better support of Alpine. I still don't get why it wasn't reported as an issue as well by @OTLabs .

I now struggle with the locale test. It looks like locales are not really implemented, at least setting a locale always succeed.

If I make a simple test on a Debian, it fails if locale setting is not supported locally:

docker run -it --rm -v $PWD:/src python:3.11-slim-bookworm python -c "exec(\"import locale\nlocale.setlocale(locale.LC_ALL, ('bam', 'UTF-8'))\")"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<string>", line 2, in <module>
  File "/usr/local/lib/python3.11/locale.py", line 627, in setlocale
    return _setlocale(category, locale)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
locale.Error: unsupported locale setting

If I do the same on Alpine, it always succeed (it returns nothing):

docker run -it --rm -v $PWD:/src python:3.11-alpine python -c "exec(\"import locale\nlocale.setlocale(locale.LC_ALL, ('bam', 'UTF-8'))\")"       

I searched online but found no relevant hint on what to do. Is someone more successful?

@rgaudin
Copy link
Member

rgaudin commented Feb 12, 2024

Not fixing your problem but I don't understand your exec here.

❯ docker run -it --rm -v $PWD:/src python:3.11-alpine python -c 'import locale ; print(locale.setlocale(locale.LC_ALL, ("nopnopop", "UTF-8")))'
nopnopop.UTF-8

This returns although it's not failing due to missing locale as you would expect…

@benoit74
Copy link
Collaborator

I'm just not as used as you are to write Python one-liners, but it is almost the same thing, I just didn't googled enough about how to write one-liners 😉

@benoit74
Copy link
Collaborator

@OTLabs

Few things:

  • we are about to have fixed as much as we can with Fix alpine tests #133 but we have an issue with our i18n since it rely on locale which is mostly not supported on Alpine
  • you should run the tests with a --runslow additional argument (e.g pytest --runslow) to have a real coverage of the whole codebase

Once #133 is merged I will close this issue since we will have answered your concerns, please track #134 progress if you want to be informed of the next steps.

@kelson42 kelson42 unpinned this issue Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants