Skip to content

unchanged project has two test failures #157

@richterdavid

Description

@richterdavid

On slack, asking about this got this response from rgaudin:

it’s testing locales and you don’t have them on the system testing it. Open a
ticket but it will be a duplicate. We already have a ticket to switch to a bundled approach (babel)

Full test logs:

github/python-scraperlib$ invoke coverage
================================================= test session starts ==================================================
platform linux -- Python 3.11.2, pytest-8.1.1, pluggy-1.5.0
rootdir: /home/david/github/python-scraperlib
configfile: pyproject.toml
testpaths: tests
plugins: mock-3.12.0, anyio-4.3.0
collected 374 items

tests/download/test_download.py .....sssssssssssss......                                                         [  6%]
tests/filesystem/test_filesystem.py ......                                                                       [  8%]
tests/html/test_html.py ......                                                                                   [  9%]
tests/i18n/test_i18n.py .......................FF                                                                [ 16%]
tests/image/test_image.py ..............................................................................         [ 37%]
tests/inputs/test_inputs.py ......................                                                               [ 43%]
tests/logging/test_logging.py .................                                                                  [ 47%]
tests/misc/test_misc.py ....                                                                                     [ 48%]
tests/ogvjs/test_ogvjs.py ..ss                                                                                   [ 49%]
tests/types/test_types.py ..............                                                                         [ 53%]
tests/uri/test_uri.py ..............                                                                             [ 57%]
tests/video/test_encoding.py ....                                                                                [ 58%]
tests/video/test_video.py ...ssss......ssssssssss                                                                [ 64%]
tests/zim/test_archive.py ......ss...                                                                            [ 67%]
tests/zim/test_fs.py ..........                                                                                  [ 70%]
tests/zim/test_libkiwix.py .................                                                                     [ 74%]
tests/zim/test_metadata.py .......                                                                               [ 76%]
tests/zim/test_zim_creator.py .................................................................................. [ 98%]
......                                                                                                           [100%]

======================================================= FAILURES =======================================================
_________________________________________ test_translation[fr-Bonjour monde !] _________________________________________

lang = 'fr', expected = 'Bonjour monde !'

    @pytest.mark.parametrize(
        "lang,expected",
        [("en", "Hello World!"), ("fr", "Bonjour monde !"), ("pt_BR.utf8", "Olá Mundo!")],
    )
    def test_translation(lang, expected):
>       setlocale(pathlib.Path(__file__).parent, lang)

tests/i18n/test_i18n.py:215:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/zimscraperlib/i18n.py:59: in setlocale
    return Locale.setup(root_dir / "locale", locale_name)
src/zimscraperlib/i18n.py:39: in setup
    computed = locale.setlocale(locale.LC_ALL, (cls.lang, cls.encoding))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

category = 6, locale = 'fr_FR.UTF-8'

    def setlocale(category, locale=None):

        """ Set the locale for the given category.  The locale can be
            a string, an iterable of two strings (language code and encoding),
            or None.

            Iterables are converted to strings using the locale aliasing
            engine.  Locale strings are passed directly to the C lib.

            category may be given as one of the LC_* values.

        """
        if locale and not isinstance(locale, _builtin_str):
            # convert to string
            locale = normalize(_build_localename(locale))
>       return _setlocale(category, locale)
E       locale.Error: unsupported locale setting

/usr/lib/python3.11/locale.py:626: Error
______________________________________ test_translation[pt_BR.utf8-Ol\xe1 Mundo!] ______________________________________

lang = 'pt_BR.utf8', expected = 'Olá Mundo!'

    @pytest.mark.parametrize(
        "lang,expected",
        [("en", "Hello World!"), ("fr", "Bonjour monde !"), ("pt_BR.utf8", "Olá Mundo!")],
    )
    def test_translation(lang, expected):
>       setlocale(pathlib.Path(__file__).parent, lang)

tests/i18n/test_i18n.py:215:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/zimscraperlib/i18n.py:59: in setlocale
    return Locale.setup(root_dir / "locale", locale_name)
src/zimscraperlib/i18n.py:39: in setup
    computed = locale.setlocale(locale.LC_ALL, (cls.lang, cls.encoding))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

category = 6, locale = 'pt_BR.UTF-8'

    def setlocale(category, locale=None):

        """ Set the locale for the given category.  The locale can be
            a string, an iterable of two strings (language code and encoding),
            or None.

            Iterables are converted to strings using the locale aliasing
            engine.  Locale strings are passed directly to the C lib.

            category may be given as one of the LC_* values.

        """
        if locale and not isinstance(locale, _builtin_str):
            # convert to string
            locale = normalize(_build_localename(locale))
>       return _setlocale(category, locale)
E       locale.Error: unsupported locale setting

/usr/lib/python3.11/locale.py:626: Error
=============================================== short test summary info ================================================
FAILED tests/i18n/test_i18n.py::test_translation[fr-Bonjour monde !] - locale.Error: unsupported locale setting
FAILED tests/i18n/test_i18n.py::test_translation[pt_BR.utf8-Ol\xe1 Mundo!] - locale.Error: unsupported locale setting
====================================== 2 failed, 341 passed, 31 skipped in 37.22s ======================================

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions