pimutils / khal

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

Test failures with 0.8.4 #546

Closed lfam closed 7 years ago

lfam commented 7 years ago

Building khal 0.8.4 in Guix, the tests test_default_calendar and test_only_update_old_event are failing. I tried increasing the sleeps to 1 second but the tests still failed.

What do you think? Does it indicate a real problem, or can we disable these tests for now?

=================================== FAILURES ===================================
____________________________ test_default_calendar _____________________________

coll_vdirs = (<khal.khalendar.khalendar.CalendarCollection object at 0x7ffff11f6278>, {'foobar': <FilesystemStorage(**{'path': '/tm...FilesystemStorage(**{'path': '/tmp/guix-build-khal-0.8.4.drv-0/pytest-nixbld/pytest-0/test_default_calendar1/work'})>})

    def test_default_calendar(coll_vdirs):
        """test if an update to the vdir is detected by the CalendarCollection"""
        coll, vdirs = coll_vdirs
        vdir = vdirs['foobar']
        event = coll.new_event(event_today, 'foobar')
        vdir.upload(event)
        sleep(0.01)
        href, etag = list(vdir.list())[0]
        assert len(list(coll.get_events_on(today))) == 0
        coll.update_db()
        sleep(0.01)
>       assert len(list(coll.get_events_on(today))) == 1
E       assert 0 == 1
E        +  where 0 = len([])
E        +    where [] = list(<itertools.chain object at 0x7ffff008bda0>)
E        +      where <itertools.chain object at 0x7ffff008bda0> = <bound method CalendarCollection.get_events_on of <khal.khalendar.khalendar.CalendarCollection object at 0x7ffff11f6278>>(datetime.date(2017, 1, 5))
E        +        where <bound method CalendarCollection.get_events_on of <khal.khalendar.khalendar.CalendarCollection object at 0x7ffff11f6278>> = <khal.khalendar.khalendar.CalendarCollection object at 0x7ffff11f6278>.get_events_on

tests/khalendar_test.py:335: AssertionError
__________________________ test_only_update_old_event __________________________

coll_vdirs = (<khal.khalendar.khalendar.CalendarCollection object at 0x7ffff1183588>, {'foobar': <FilesystemStorage(**{'path': '/tm...ystemStorage(**{'path': '/tmp/guix-build-khal-0.8.4.drv-0/pytest-nixbld/pytest-0/test_only_update_old_event0/work'})>})
monkeypatch = <_pytest.monkeypatch.monkeypatch object at 0x7ffff197bdd8>

    def test_only_update_old_event(coll_vdirs, monkeypatch):
        coll, vdirs = coll_vdirs

        href_one, etag_one = vdirs[cal1].upload(coll.new_event(dedent("""
        BEGIN:VEVENT
        UID:meeting-one
        DTSTART;VALUE=DATE:20140909
        DTEND;VALUE=DATE:20140910
        SUMMARY:first meeting
        END:VEVENT
        """), cal1))

        href_two, etag_two = vdirs[cal1].upload(coll.new_event(dedent("""
        BEGIN:VEVENT
        UID:meeting-two
        DTSTART;VALUE=DATE:20140910
        DTEND;VALUE=DATE:20140911
        SUMMARY:second meeting
        END:VEVENT
        """), cal1))

        sleep(0.01)
        coll.update_db()
        sleep(0.01)
        assert not coll._needs_update(cal1)

        old_update_vevent = coll._update_vevent
        updated_hrefs = []

        def _update_vevent(href, calendar):
            updated_hrefs.append(href)
            return old_update_vevent(href, calendar)
        monkeypatch.setattr(coll, '_update_vevent', _update_vevent)

        href_three, etag_three = vdirs[cal1].upload(coll.new_event(dedent("""
        BEGIN:VEVENT
        UID:meeting-three
        DTSTART;VALUE=DATE:20140911
        DTEND;VALUE=DATE:20140912
        SUMMARY:third meeting
        END:VEVENT
        """), cal1))
        sleep(0.01)

        assert coll._needs_update(cal1)
        coll.update_db()
        sleep(0.01)
>       assert updated_hrefs == [href_three]
E       assert ['meeting-thr...ting-one.ics'] == ['meeting-three.ics']
E         Left contains more items, first extra item: 'meeting-two.ics'
E         Use -v to get the full diff

tests/khalendar_test.py:391: AssertionError
=============== 2 failed, 174 passed, 2 xfailed in 55.27 seconds ===============
untitaker commented 7 years ago

This sometimes happens to me as well, but I have no idea why.

geier commented 7 years ago

I believe this is the same issue as #529, which I believe is fixed with #543, which may need some beautification.

lfam commented 7 years ago

So, what do you suggest we do? Should we just disable these tests?

geier commented 7 years ago

I'd suggest marking them as xfail. It's going to be too much for to apply the fixes onto the 0.8 branch. And it shouldn't be an issue in real usage.

Quoting lfam (2017-01-06 00:05:20)

So, what do you suggest we do? Should we just disable these tests?

-- You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub: https://github.com/pimutils/khal/issues/546#issuecomment-270783981