Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit test test_parse_time_with_now_and_utc fails around DST change #4523

Closed
fedepell opened this issue Oct 30, 2022 · 1 comment
Closed

Unit test test_parse_time_with_now_and_utc fails around DST change #4523

fedepell opened this issue Oct 30, 2022 · 1 comment

Comments

@fedepell
Copy link
Contributor

Very minor but reporting as it was creating me headaches, running tests just exactly today.

It seems to me that the test_parse_time_with_now_and_utc test will fail if run just on the day of DST change (ie. today) or the day before as they are doing comparisons with +/- 1 day and a hardcoded seconds difference value, which is incorrect if the DST happens between the two cases compared.

Specifically today (last night DST changed here) I see failing those tests:

                                ('now - 1 day 100 seconds',-86500),
                                ('NOW - 1D 10H 1MIN 10S', -122470)]:

Probably yesterday (so just before DST change) would be the ones with +.

As written above I'm not sure this is worth investigating and fixing, but just wanted to report as it gave me by chance some worries while rebuilding and retesting the new version of Robotframework. I will just redo the tests tomorrow ;-)

Version Information:
Tried with both 6.0 and 5.0.1

Steps to reproduce:
Run the unit tests, specifically on the day immediately before or after DST change.

Error message and traceback:

======================================================================
FAIL: test_parse_time_with_now_and_utc (test_robottime.TestTime)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/foo/rpmbuild/BUILD/robotframework-6.0/utest/utils/test_robottime.py", line 341, in test_parse_time_with_now_and_utc
    assert_true(expected <= parsed <= expected + 1),
  File "/home/foo/rpmbuild/BUILD/robotframework-6.0/utest/../src/robot/utils/asserts.py", line 115, in assert_true
    _report_failure(msg)
  File "/home/foo/rpmbuild/BUILD/robotframework-6.0/utest/../src/robot/utils/asserts.py", line 218, in _report_failure
    raise AssertionError()
AssertionError

----------------------------------------------------------------------
@pekkaklarck
Copy link
Member

Thanks for the report. It seems the code takes possible DST change correctly into account. Based on the version control history the code was enhanced last January in eb82172 to fix #4143. Need to enhance this unit test to take possible DST transition into account. Not too hard but god I hate DST.

@pekkaklarck pekkaklarck added this to the v6.0.1 milestone Oct 30, 2022
@pekkaklarck pekkaklarck changed the title test_parse_time_with_now_and_utc test fail if just in day of DST change Unit test test_parse_time_with_now_and_utc fails around DST change Oct 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants