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

tests failing during collection on 3.12 #44

Open
alisterburt opened this issue Jan 16, 2024 · 4 comments
Open

tests failing during collection on 3.12 #44

alisterburt opened this issue Jan 16, 2024 · 4 comments

Comments

@alisterburt
Copy link
Member

not sure what's going on here, this is all internal to pandas and not starfile code but can't find anyone complaining online... have disabled 3.12 tests for now but they should be reenabled

https://github.com/teamtomo/starfile/actions/runs/7534153554/job/20508013242?pr=43

ERROR tests/test_functional_interface.py - DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC).
ERROR tests/test_parsing.py - AttributeError: partially initialized module 'pandas' has no attribute '_pandas_datetime_CAPI' (most likely due to a circular import)
ERROR tests/test_read_write_round_trip.py - AttributeError: partially initialized module 'pandas' has no attribute '_pandas_datetime_CAPI' (most likely due to a circular import)
ERROR tests/test_writing.py - AttributeError: partially initialized module 'pandas' has no attribute '_pandas_datetime_CAPI' (most likely due to a circular import)
@DanGonite57
Copy link

This looks to be due to the DeprecationWarning. If you run the tests with pytest .\tests\ -W ignore::DeprecationWarning everything passes as normal.

My best guess as to why is that pytest fails on the DeprecationWarning which occurs while pandas is importing dateutil.tz, and immediately cancels the import process, leading to the "partially initialized" state in subsequent tests.

@alisterburt
Copy link
Member Author

Hey @DanGonite57 ! Thanks for checking this out.

You're absolutely right! I solved this in another project with some warning filters around offending imports - ugly but it works

https://github.com/teamtomo/mmdf/blob/main/tests/test_functions.py

If you'd like to open a PR with similar here I'd appreciate it! Otherwise I'll fix it myself when I find some time :-)

@DanGonite57
Copy link

Is there any case where you would want pytest to fail on certain deprecation warnings (or certain warnings in general) but not others? If not, I might suggest adjusting the configuration in the pyproject.toml instead

@alisterburt
Copy link
Member Author

@DanGonite57 unsure, I think I want to see them when testing against pre-release versions of packages etc? Definitely open to alternative solutions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants