Closed OTLabs closed 4 months ago
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
How critical is that? Sounds blocking for Alpine packaging.
Will change the tests very soon ; this is happening on various platforms
@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
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 👍
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?
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…
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 😉
@OTLabs
Few things:
--runslow
additional argument (e.g pytest --runslow
) to have a real coverage of the whole codebaseOnce #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.
While building a package for Alpine Linux, musl, I got 3 failed tests:
How critical are these tests? Could I ignore them?