Tests depend on specific `TZ` setting
See original GitHub issueTry
TZ=UTC python setup.py test
This should cause timestamp-parsing-related test failures.
I suppose that the timestamp parser relies on the current TZ
environment setting being the same as the one used for generating the timestamp, which might not be the case for the pre-recorded test input. I had to explicitly run
TZ=America/Los_Angeles python setup.py test
to make the tests succeed.
IMHO, the test script should take care of setting the expected timezone.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:16 (8 by maintainers)
Top Results From Across the Web
How do I set a timezone in my Jest config? - Stack Overflow
If you have a specific component that needs to work with local timezones, mock that out in that specific test instead of globally....
Read more >How to configure & run Jest tests with a specific timezone?
You can instantly run the tests via command as below: TZ="Asia/Singapore" yarn ... Solution #2: Configure timezone in the Jest global setup.
Read more >Testing Time Zones in Parallel - Gleb Bahmutov
This blog post shows step by step how to execute the same tests for different browser time zone settings. Then I show how...
Read more >Configure timezones for Selenium tests | BrowserStack Docs
Supported capability value Description Time zone to be set
UTC GMT GMT Standard Time
Abidjan Africa/Abidjan Greenwich Standard Time
Accra Africa/Accra Greenwich Standard Time
Read more >A Simple Guide for Testing DateTime - Mudbath
Make your test timezone agnostic ... Do not create datetimes relative to the machine's timezone, but expect datetimes with a specified timezone.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Actually, I think I’m just going to
.upper()
the period (‘AM’/‘PM’) text so it’s always consistent across systems.Hi @chocolateboy - thanks for reporting this. This looks like a separate issue around the capitalization of the AM/PM period in the jc output. On my system it looks like AM/PM should be capitalized, though it looks like it is lowercase on your system.
What python version is installed on the system?
According to this (https://stackoverflow.com/questions/38863210/how-to-make-pythons-datetime-object-show-am-and-pm-in-lowercase#:~:text=In the en_US locale%2C AM,You can use locale.) it looks like the capitalization of AM/PM can depend on the Locale setting. Maybe I can set the Locale for the tests to
C
so they don’t fail.