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

Fix alpine tests #133

Merged
merged 6 commits into from
Feb 13, 2024
Merged

Fix alpine tests #133

merged 6 commits into from
Feb 13, 2024

Conversation

benoit74
Copy link
Collaborator

@benoit74 benoit74 commented Feb 13, 2024

Fix #114 (remaining part is now tracked in #134)

Original comment

Partial fix of #114, the following test is still failing ; looks like on Alpine setlocale is never raising an error, see issue for details. I don't know if we accept to live with it or add a special detection for Alpine Linux which would skip the test.

FAILED tests/i18n/test_i18n.py::test_selocale_unsupported - Failed: DID NOT RAISE <class 'locale.Error'>

Rationale

Some tests were failing on Alpine Linux + file-magic is not well maintained / not supporting Alpine Linux

Changes

  • replace file-magic by python-magic library, since the last one has support for Alpine + is better maintained
  • add installation instruction for Alpine (maybe partial, at least sufficient for tests to pass)
  • fix ffprobe test which was failing due to different bitrates being reported, we now allow 1% variability from expected value (we do not mind much about the exact bitrate)

Copy link

codecov bot commented Feb 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (e167913) 100.00% compared to head (68d3e30) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #133   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           32        32           
  Lines         1345      1345           
  Branches       229       229           
=========================================
  Hits          1345      1345           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@benoit74 benoit74 marked this pull request as ready for review February 13, 2024 08:48
Copy link
Member

@rgaudin rgaudin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, Alpine doesn't have locales and the musl-locales package is very limited.

See https://grrr.tech/posts/2020/add-locales-to-alpine-linux-docker-image/

The best way forward might be to not rely on system locale but to depend on and use an external locale-data such as what Babel does.
I am confident all our use cases can switch to it but it must be checked obviously.

I'd thus advise we:

  • open a ticket to change i18n system
  • mention Alpine in that ticket
  • update the readme near Alpine part mentioning that locale stuff are not OK and point to the ticket.

WDYT?

src/zimscraperlib/filesystem.py Show resolved Hide resolved
@benoit74
Copy link
Collaborator Author

Agreed regarding the approach for finishing Alpine support: #134

@benoit74
Copy link
Collaborator Author

I don't know why the CI is not trigered anymore ; may I rebase/force-push before you review the last commits?

@rgaudin
Copy link
Member

rgaudin commented Feb 13, 2024

I don't know why the CI is not trigered anymore ; may I rebase/force-push before you review the last commits?

Yes ; might be a GH issue ; I've had a similar pb on a different repo today

python-magic is supporting Alpine Linux since 0.4.24 (hence the minimum
version) while file-magic is still not supporting it.
@benoit74
Copy link
Collaborator Author

Force push done, CI is green, please review

Copy link
Member

@rgaudin rgaudin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe there's a typo in the range

pyproject.toml Outdated Show resolved Hide resolved
@benoit74
Copy link
Collaborator Author

🤦🏻

Copy link
Member

@rgaudin rgaudin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤓

@benoit74 benoit74 merged commit 5d95d59 into main Feb 13, 2024
10 checks passed
@benoit74 benoit74 deleted the fix_alpine_tests branch February 13, 2024 16:09
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

Successfully merging this pull request may close these issues.

3 failed tests on Alpine Linux
2 participants