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

TST: tzdata is a required dependency when testing #47332

Closed
simonjayhawkins opened this issue Jun 13, 2022 · 7 comments · Fixed by #47467
Closed

TST: tzdata is a required dependency when testing #47332

simonjayhawkins opened this issue Jun 13, 2022 · 7 comments · Fixed by #47467
Assignees
Labels
Testing pandas testing functions or related to the test suite Windows Windows OS
Milestone

Comments

@simonjayhawkins
Copy link
Member

Nightlies are sadly still broken.
On Windows, the failures are because tzdata is a required dependency when testing, because of a bug here.

pandas/pandas/conftest.py

Lines 1219 to 1220 in 259a15c

if zoneinfo is not None:
TIMEZONES.extend([zoneinfo.ZoneInfo("US/Pacific"), zoneinfo.ZoneInfo("UTC")])

We need to create a dummy ZoneInfo object and check to see if that works as zoneinfo will not raise if tzdata is missing on import, only when creating the ZoneInfo object.

tzdata should also probably be added to the optional dependencies list in the docs and in pandas/compat/_optional.py.
I dunno which minimum version we should support though.

cc @jbrockmendel (who added zoneinfo support)

Originally posted by @lithomas1 in #46856 (comment)

@simonjayhawkins simonjayhawkins added the Testing pandas testing functions or related to the test suite label Jun 13, 2022
@lithomas1 lithomas1 added this to the 1.5 milestone Jun 13, 2022
@jbrockmendel
Copy link
Member

We need to create a dummy ZoneInfo object and check to see if that works as zoneinfo will not raise if tzdata is missing on import, only when creating the ZoneInfo object.

Would making tzdata required solve the issue? Seems easier.

@simonjayhawkins
Copy link
Member Author

simonjayhawkins commented Jun 13, 2022

for the nightlies to upload, will just skip the test for now (on https://github.com/MacPython/pandas-wheels). If tests fail the wheel upload to staging is bypassed.

@simonjayhawkins
Copy link
Member Author

will just skip the test for now (on https://github.com/MacPython/pandas-wheels).

talking rubbish. Fails with ImportError while loading conftest 'D:\a\1\s\test_venv\lib\site-packages\pandas\conftest.py'. we can skip tests on pandas-wheels, but we don't patch pandas. Should fix here, but can maybe add tzdata to the setup script there for now.

@simonjayhawkins simonjayhawkins added the Windows Windows OS label Jun 13, 2022
@simonjayhawkins
Copy link
Member Author

added tzdata to TEST_DEPENDS for windows env for now. MacPython/pandas-wheels#185

issue remains open to fix in pandas so that pd.test() always works.

@lithomas1 lithomas1 added the Blocker for rc Blocking issue or pull request for release candidate label Jun 13, 2022
@lithomas1
Copy link
Member

The idea is probably to do something like

try:
    utc_zoneinfo = ZoneInfo("UTC")
except ZoneInfoNotFoundError:
    zoneinfo = None

in the conftest.
I don't have time to look into this this week, though, so someone else needs to put up a PR. Marked as blocker for rc, since min deps builds should just work.

@lithomas1
Copy link
Member

We need to create a dummy ZoneInfo object and check to see if that works as zoneinfo will not raise if tzdata is missing on import, only when creating the ZoneInfo object.

Would making tzdata required solve the issue? Seems easier.

Slightly off topic, but is the idea to replace pytz in the future with tzdata?

@jbrockmendel
Copy link
Member

Slightly off topic, but is the idea to replace pytz in the future with tzdata?

i suggested something similar at one point, but definitely not something decided upon

@lithomas1 lithomas1 self-assigned this Jun 22, 2022
@simonjayhawkins simonjayhawkins removed the Blocker for rc Blocking issue or pull request for release candidate label Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing pandas testing functions or related to the test suite Windows Windows OS
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants