question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tests depend on specific `TZ` setting

See original GitHub issue

Try

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:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:16 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
kellyjonbrazilcommented, Mar 5, 2022

Actually, I think I’m just going to .upper() the period (‘AM’/‘PM’) text so it’s always consistent across systems.

1reaction
kellyjonbrazilcommented, Mar 5, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found