GothenburgBitFactory / GothenburgBitFactory/timewarrior

test_totals_with_time_delta_larger_than_24_hours fails after daylight saving time change

Open
#568 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
1.7k
Forks
117
Avg merge
1d 7h
Merged PRs (30d)
5

Description

Steps taken:
* download and extract https://github.com/GothenburgBitFactory/timewarrior/releases/download/v1.6.0/timew-1.6.0.tar.gz.
* Run cmake, make, and make test as per README.md.

Expected all tests to pass, but one did not: test_totals_with_time_delta_larger_than_24_hours failed because the start time actual was one hour off the expected time.

```
$ make test
...
not ok 17 - test_totals.t: totals extension should print report for time delta larger than 24 hours
# FAIL: AssertionError on file /home/sstock/src-remote/timew-1.6.0/test/test_totals.t line 110 in test_totals_with_time_delta_larger_than_24_hours: 'self.assertEqual(':
# Lists differ: ['', [26 chars]-04 07:53:03 - 2023-11-06 07:53:03', '', 'Tag [93 chars], ''] != ['', [26 chars]-04 08:53:03 - 2023-11-06 07:53:03', '', 'Tag [93 chars], '']
#
# First differing element 1:
# 'Total by Tag, for 2023-11-04 07:53:03 - 2023-11-06 07:53:03'
# 'Total by Tag, for 2023-11-04 08:53:03 - 2023-11-06 07:53:03'
#
# ['',
# - 'Total by Tag, for 2023-11-04 07:53:03 - 2023-11-06 07:53:03',
# ? ^
#
# + 'Total by Tag, for 2023-11-04 08:53:03 - 2023-11-06 07:53:03',
# ? ^
#
# '',
# 'Tag Total',
# '----- ----------',
# 'foo 48:00:00',
# ' ----------',
# 'Total 48:00:00',
# '']
...
Passed: 1457
Failed: 1
Unexpected successes: 0
Skipped: 7
Expected failures: 0
Runtime: 2.69 seconds
make[3]: *** [test/CMakeFiles/test.dir/build.make:82: test/CMakeFiles/test] Error 1
make[2]: *** [CMakeFiles/Makefile2:517: test/CMakeFiles/test.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:524: test/CMakeFiles/test.dir/rule] Error 2
make: *** [Makefile:306: test] Error 2
```

The significant aspect here is daylight saving time ended less than 48 hours ago. The test uses two times, now and 48 hours prior to now. The input times both use UTC. However the output (expected) values use the local time zone (in my case US/Eastern). I expect if I wait approximately 18 more hours the test will pass (update: 24 hours later and the test now passes when using my local time zone).

Forcing my local time zone to UTC, or any other that didn't recently change DST (e.g. Europe/Prague), allows the test to pass:
```
$ TZ=UTC make test
...
Passed: 1458
Failed: 0
Unexpected successes: 0
Skipped: 7
Expected failures: 0
Runtime: 2.70 seconds
[100%] Built target test
```

Note: relates to #255.

Miscellaneous details:
OS: Ubuntu 22.04.3 LTS
Python: Python 3.10.12

Contributor guide

Open the contributing guide

Research direction

Start with test_totals.t, especially test_totals_with_time_delta_larger_than_24_hours at line 110, and reproduce the failure with make test in a timezone crossing a daylight-saving transition. Compare the UTC input and local-time output handling, then confirm the test passes both across a DST transition and with TZ=UTC.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp, python
Domain
cli, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.