Skip to content

Fix list-translations() ordering in tests #242

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

k0tran
Copy link

@k0tran k0tran commented Aug 7, 2024

So the list_translations() method uses os.listdir() without any additional params. This can yield different results on different machines:

# ...
                if any(x.endswith(".mo") for x in os.listdir(locale_dir)):
                    result.append(Locale.parse(folder))
# ...

For example:

$ python3 -python3 -c "print(__import__('os').listdir('./tests/translations'))"
['messages.pot', 'ja', 'de', 'fr'] # on my x64_64 machine
['fr', 'messages.pot', 'de', 'ja'] # on my loongarch64 machine

The documentation of list_translations() say nothing about translations ordering. So I've decided that it's error in tests hence this PR is changing them rather that list_translations() method.

@k0tran k0tran changed the title Fix patch changing list-translations() ordering in tests Fix list-translations() ordering in tests Aug 7, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant