pimutils / khal

:calendar: CLI calendar application
https://lostpackets.de/khal/
MIT License
2.62k stars 207 forks source link

Test failure: test_set_focus_date_weekstart_6 #470

Closed pwnage101 closed 8 years ago

pwnage101 commented 8 years ago

I'm trying to package khal 0.8.2 for GNU Guix, but the following test fails: test_set_focus_date_weekstart_6 in tests/ui/test_calendarwidget.py.

Relevant snippet from the build log:

starting phase `check'
============================= test session starts ==============================
platform linux -- Python 3.4.3 -- py-1.4.31 -- pytest-2.7.3
rootdir: /tmp/guix-build-khal-0.8.2.drv-0/khal-0.8.2, inifile: 
plugins: cov
collected 176 items

tests/aux_test.py .....................
tests/backend_test.py .........................
tests/cal_display_test.py ....x.
tests/cli_test.py .....x.............
tests/controller_test.py ....
tests/event_test.py .............................
tests/khalendar_aux_test.py ................................
tests/khalendar_test.py ......................
tests/settings_test.py ........
tests/terminal_test.py ...
tests/vtimezone_test.py ...
tests/ui/test_calendarwidget.py ..F
tests/ui/test_widgets.py .

=================================== FAILURES ===================================
_______________________ test_set_focus_date_weekstart_6 ________________________

    def test_set_focus_date_weekstart_6():

        with freeze_time('2016-04-10'):
            today = date.today()
            for diff in range(-21, 21, 1):
                frame = CalendarWidget(on_date_change=lambda _: None,
                                       keybindings=keybindings,
                                       on_press=on_press,
                                       firstweekday=6,
>                                      weeknumbers='right')

tests/ui/test_calendarwidget.py:48: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
khal/ui/calendarwidget.py:607: in __init__
    self.set_focus_date(self._initial)
khal/ui/calendarwidget.py:624: in set_focus_date
    self.box.set_focus_date(a_day)
khal/ui/calendarwidget.py:297: in set_focus_date
    self.body.set_focus_date(a_day)
khal/ui/calendarwidget.py:371: in set_focus_date
    row, column = self.get_date_pos(a_day)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = CalendarWalker([<DateCColumns from 2016-06-26 to 2016-07-02>, <DateCColumns from 2016-07-03 to 2016-07-09>, <DateCColu...4 to 2016-08-20>, <DateCColumns from 2016-08-21 to 2016-08-27>, <DateCColumns from 2016-08-28 to 2016-09-03>], focus=5)
a_day = FakeDate(2016, 4, 10)

    def get_date_pos(self, a_day):
        """get row and column where `a_day` is located

            :type: a_day: datetime.date
            :rtype: tuple(int, int)
            """
        # rough estimate of difference in lines, i.e. full weeks, we might be
        # off by as much as one week though
        week_diff = int((self.focus_date - a_day).days / 7)
        new_focus = self.focus - week_diff
        # in case new_focus is 1 we will later try set the focus to 0 which
        # will lead to an autoprepend which will f*ck up our estimation,
        # therefore better autoprepending anyway, even if it might not be
        # necessary
        if new_focus <= 1:
            self._autoprepend()
            week_diff = int((self.focus_date - a_day).days / 7)
            new_focus = self.focus - week_diff
        for offset in [0, -1, 1]:  # we might be off by a week
            row = new_focus + offset
            try:
                if row >= len(self):
                    self._autoextend()
>               column = self[row].get_date_column(a_day)
E               IndexError: list index out of range

khal/ui/calendarwidget.py:409: IndexError
=============== 1 failed, 173 passed, 2 xfailed in 27.22 seconds ===============
phase `check' failed after 31.5 seconds

In Travis, all the tests in the 0.8.x branch passed, so this certainly could be an issue with dependency versions. From within a Guix development environment (using ./pre-inst-env guix environment khal) git bisect tells me that 8a802825 fixes the bug triggering this test:

8a802825ed3a0f06b387e8af45e68f17cccc0841 is the first fixed commit
commit 8a802825ed3a0f06b387e8af45e68f17cccc0841
Author: Christian Geier <geier@lostpackets.de>
Date:   Tue Apr 26 01:00:19 2016 +0200

    Fix Calendarwidget: start contstructing inital month

The commit message sounds related to the failed test. I'd rather not package khal with a known bug which is fixed in master, but maybe that's okay. I'd appreciate some guidance on this.

More boring info below this line:

Full build log from guix build khal: https://gist.githubusercontent.com/pwnage101/b95dee3e1ff799184a9f6922696f15e8/raw/0b7439a940c4549e54d9242f33fd97f672b30258/build_log.txt

Here's a sorted list of all the dependencies being used to build khal and its dependencies, excluding implicit dependencies such as GCC, tar, make, etc.: https://gist.github.com/pwnage101/b95dee3e1ff799184a9f6922696f15e8/raw/0b7439a940c4549e54d9242f33fd97f672b30258/dependency_closure.txt

The guix package definition used for this build: https://gist.githubusercontent.com/pwnage101/b95dee3e1ff799184a9f6922696f15e8/raw/0b7439a940c4549e54d9242f33fd97f672b30258/package_definition.scm

pwnage101 commented 8 years ago

458 talks about this test, this version of khal, and guix. I should not have created a new issue.,