tobi-wan-kenobi / bumblebee-status

bumblebee-status is a modular, theme-able status line generator for the i3 window manager.
https://bumblebee-status.readthedocs.io/en/main/
MIT License
1.23k stars 229 forks source link

date tests fails on musl #804

Closed ardadem closed 3 years ago

ardadem commented 3 years ago

Bug Report

Description

Affected module: date, datetime and time Version used: 2.1.4

============================= test session starts ==============================
platform linux -- Python 3.9.6, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /builddir/bumblebee-status-2.1.4
plugins: mock-3.5.1
collected 251 items / 25 skipped / 226 selected

tests/core/test_config.py ..............                                 [  5%]
tests/core/test_decorators.py .........                                  [  9%]
tests/core/test_event.py .....                                           [ 11%]
tests/core/test_input.py .......                                         [ 13%]
tests/core/test_module.py ................                               [ 20%]
tests/core/test_output.py .................                              [ 27%]
tests/core/test_theme.py ...........                                     [ 31%]
tests/core/test_widget.py .........                                      [ 35%]
tests/modules/contrib/test_amixer.py ...........                         [ 39%]
tests/modules/contrib/test_apt.py .                                      [ 39%]
tests/modules/contrib/test_arch-update.py ......                         [ 42%]
tests/modules/contrib/test_brightness.py .                               [ 42%]
tests/modules/contrib/test_caffeine.py .                                 [ 43%]
tests/modules/contrib/test_cmus.py .                                     [ 43%]
tests/modules/contrib/test_cpu2.py .                                     [ 43%]
tests/modules/contrib/test_deadbeef.py .                                 [ 44%]
tests/modules/contrib/test_dnf.py .                                      [ 44%]
tests/modules/contrib/test_dunst.py .                                    [ 45%]
tests/modules/contrib/test_dunstctl.py ....                              [ 46%]
tests/modules/contrib/test_getcrypto.py .                                [ 47%]
tests/modules/contrib/test_github.py .                                   [ 47%]
tests/modules/contrib/test_gpmdp.py .                                    [ 47%]
tests/modules/contrib/test_hddtemp.py .                                  [ 48%]
tests/modules/contrib/test_hostname.py .                                 [ 48%]
tests/modules/contrib/test_http_status.py .                              [ 49%]
tests/modules/contrib/test_indicator.py .                                [ 49%]
tests/modules/contrib/test_kernel.py ..                                  [ 50%]
tests/modules/contrib/test_layout-xkbswitch.py ......                    [ 52%]
tests/modules/contrib/test_layout.py .                                   [ 52%]
tests/modules/contrib/test_messagereceiver.py .                          [ 53%]
tests/modules/contrib/test_mocp.py .                                     [ 53%]
tests/modules/contrib/test_mpd.py .........                              [ 57%]
tests/modules/contrib/test_network_traffic.py ........                   [ 60%]
tests/modules/contrib/test_notmuch_count.py .                            [ 60%]
tests/modules/contrib/test_nvidiagpu.py .                                [ 61%]
tests/modules/contrib/test_pacman.py .                                   [ 61%]
tests/modules/contrib/test_pihole.py .                                   [ 62%]
tests/modules/contrib/test_playerctl.py .                                [ 62%]
tests/modules/contrib/test_pomodoro.py .                                 [ 62%]
tests/modules/contrib/test_portage_status.py .                           [ 63%]
tests/modules/contrib/test_prime.py .                                    [ 63%]
tests/modules/contrib/test_progress.py .                                 [ 64%]
tests/modules/contrib/test_publicip.py ....                              [ 65%]
tests/modules/contrib/test_rotation.py .                                 [ 66%]
tests/modules/contrib/test_sensors.py .                                  [ 66%]
tests/modules/contrib/test_shell.py .                                    [ 66%]
tests/modules/contrib/test_shortcut.py .                                 [ 67%]
tests/modules/contrib/test_smartstatus.py .                              [ 67%]
tests/modules/contrib/test_spaceapi.py .                                 [ 68%]
tests/modules/contrib/test_stock.py .                                    [ 68%]
tests/modules/contrib/test_todo.py .                                     [ 68%]
tests/modules/contrib/test_traffic.py .                                  [ 69%]
tests/modules/contrib/test_twmn.py .                                     [ 69%]
tests/modules/contrib/test_uptime.py ..                                  [ 70%]
tests/modules/contrib/test_watson.py .                                   [ 70%]
tests/modules/contrib/test_weather.py .                                  [ 71%]
tests/modules/contrib/test_xkcd.py .                                     [ 71%]
tests/modules/contrib/test_zpool.py .                                    [ 72%]
tests/modules/core/test_cpu.py .......                                   [ 74%]
tests/modules/core/test_date.py .FF..                                    [ 76%]
tests/modules/core/test_datetime.py .FF..                                [ 78%]
tests/modules/core/test_debug.py .                                       [ 79%]
tests/modules/core/test_disk.py .                                        [ 79%]
tests/modules/core/test_error.py .                                       [ 80%]
tests/modules/core/test_load.py ...........                              [ 84%]
tests/modules/core/test_memory.py ...........                            [ 88%]
tests/modules/core/test_nic.py .                                         [ 89%]
tests/modules/core/test_pasink.py .                                      [ 89%]
tests/modules/core/test_pasource.py .                                    [ 90%]
tests/modules/core/test_ping.py .                                        [ 90%]
tests/modules/core/test_pulseaudio.py .                                  [ 90%]
tests/modules/core/test_redshift.py .                                    [ 91%]
tests/modules/core/test_sensors2.py .                                    [ 91%]
tests/modules/core/test_spacer.py .                                      [ 92%]
tests/modules/core/test_test.py .                                        [ 92%]
tests/modules/core/test_time.py .FF..                                    [ 94%]
tests/modules/core/test_xrandr.py ..............                         [100%]

=================================== FAILURES ===================================
_________________________ DateTest.test_default_format _________________________

self = <tests.modules.core.test_date.DateTest testMethod=test_default_format>

    @freeze_time('2020-10-15 03:25:59')
    def test_default_format(self):
        module = build_module()
>       assert module.full_text(self.widget) == '10/15/2020'
E       AssertionError: assert '10/15/20' == '10/15/2020'
E         - 10/15/2020
E         ?         --
E         + 10/15/20

tests/modules/core/test_date.py:33: AssertionError
_________________________ DateTest.test_invalid_locale _________________________

self = <tests.modules.core.test_date.DateTest testMethod=test_invalid_locale>
locale_mock = <MagicMock name='getdefaultlocale' id='139911182103552'>

    @freeze_time('2020-01-10 10:20:30')
    @mock.patch('locale.getdefaultlocale')
    def test_invalid_locale(self, locale_mock):
        locale_mock.return_value = ('in-IN', 'UTF-0')

        module = build_module()
>       assert module.full_text(self.widget) == '01/10/2020'
E       AssertionError: assert '01/10/20' == '01/10/2020'
E         - 01/10/2020
E         ?         --
E         + 01/10/20

tests/modules/core/test_date.py:46: AssertionError
_______________________ DatetimeTest.test_default_format _______________________

self = <tests.modules.core.test_datetime.DatetimeTest testMethod=test_default_format>

    @freeze_time('2020-10-15')
    def test_default_format(self):
        module = build_module()
>       assert module.full_text(self.widget) == '10/15/2020 12:00:00 AM'
E       AssertionError: assert '10/15/20 00:00:00' == '10/15/2020 12:00:00 AM'
E         - 10/15/2020 12:00:00 AM
E         ?         ^ ^^^      ---
E         + 10/15/20 00:00:00
E         ?         ^ ^

tests/modules/core/test_datetime.py:33: AssertionError
_______________________ DatetimeTest.test_invalid_locale _______________________

self = <tests.modules.core.test_datetime.DatetimeTest testMethod=test_invalid_locale>
locale_mock = <MagicMock name='getdefaultlocale' id='139911183082064'>

    @freeze_time('2020-01-10 10:20:30')
    @mock.patch('locale.getdefaultlocale')
    def test_invalid_locale(self, locale_mock):
        locale_mock.return_value = ('in-IN', 'UTF-0')

        module = build_module()
>       assert module.full_text(self.widget) == '01/10/2020 10:20:30 AM'
E       AssertionError: assert '01/10/20 10:20:30' == '01/10/2020 10:20:30 AM'
E         - 01/10/2020 10:20:30 AM
E         ?         --         ---
E         + 01/10/20 10:20:30

tests/modules/core/test_datetime.py:46: AssertionError
_________________________ TimeTest.test_default_format _________________________

self = <tests.modules.core.test_time.TimeTest testMethod=test_default_format>

    @freeze_time('2020-10-15 03:25:59')
    def test_default_format(self):
        module = build_module()
>       assert module.full_text(self.widget) == '03:25:59 AM'
E       AssertionError: assert '03:25:59' == '03:25:59 AM'
E         - 03:25:59 AM
E         ?         ---
E         + 03:25:59

tests/modules/core/test_time.py:33: AssertionError
_________________________ TimeTest.test_invalid_locale _________________________

self = <tests.modules.core.test_time.TimeTest testMethod=test_invalid_locale>
locale_mock = <MagicMock name='getdefaultlocale' id='139911182383424'>

    @freeze_time('2020-01-10 10:20:30')
    @mock.patch('locale.getdefaultlocale')
    def test_invalid_locale(self, locale_mock):
        locale_mock.return_value = ('in-IN', 'UTF-0')

        module = build_module()
>       assert module.full_text(self.widget) == '10:20:30 AM'
E       AssertionError: assert '10:20:30' == '10:20:30 AM'
E         - 10:20:30 AM
E         ?         ---
E         + 10:20:30

tests/modules/core/test_time.py:46: AssertionError
=========================== short test summary info ============================
FAILED tests/modules/core/test_date.py::DateTest::test_default_format - Asser...
FAILED tests/modules/core/test_date.py::DateTest::test_invalid_locale - Asser...
FAILED tests/modules/core/test_datetime.py::DatetimeTest::test_default_format
FAILED tests/modules/core/test_datetime.py::DatetimeTest::test_invalid_locale
FAILED tests/modules/core/test_time.py::TimeTest::test_default_format - Asser...
FAILED tests/modules/core/test_time.py::TimeTest::test_invalid_locale - Asser...
================== 6 failed, 245 passed, 25 skipped in 2.03s ===================
=> ERROR: bumblebee-status-2.1.4_1: do_check: 'PYTHONPATH="$(cd build/lib* && pwd)" python3 -m pytest ${make_check_args} ${make_check_target}' exited with 1
=> ERROR:   in do_check() at common/build-style/python3-module.sh:28
Error: Process completed with exit code 1.

How to reproduce

run python3 -m pytest on musl

tobi-wan-kenobi commented 3 years ago

Thanks a lot for the report!

Will have to investigate how to reproduce and fix that

ardadem commented 3 years ago

I opened a PR on void-linux to update the package and got this. The maintainer said it's related to lack of locale files on musl so for now we skipped the date/time related tests on the package. Should i close the issue or keep it open?

tobi-wan-kenobi commented 3 years ago

I think it depends on wether musl will fix this or not. In the latter case, I would vote to keep this ticket open.

Thanks a lot!

tobi-wan-kenobi commented 3 years ago

Closing, because I cannot really fix musl not having locale files :)