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 around ZoneInfoNotFound are fragile #78

Open
pganssle opened this issue Jun 1, 2020 · 0 comments
Open

Tests around ZoneInfoNotFound are fragile #78

pganssle opened this issue Jun 1, 2020 · 0 comments

Comments

@pganssle
Copy link
Owner

pganssle commented Jun 1, 2020

The way the pure Python and C extensions are loaded side-by side is somewhat fragile, and actually had to be changed in upstream because the C extension lives at _zoneinfo instead of zoneinfo._czoneinfo (which changes how sys.modules gets populated, evidently).

The most common symptom is that in the test for bad keys, the assertRaises context manager fails to catch ZoneInfoNotFound in one or the other of the modules, because py_zoneinfo.ZoneInfoNotFound gets raised from c_zoneinfo or vice versa, for some reason.

I recall there was also a situation where trying to include typing_example in the tests to run would cause this, and I'm also seeing another manifestation at work.

This probably comes down to something like:

  1. The fact that we're doing a partial import (since to import zoneinfo._czoneinfo you need to import zoneinfo first, which then tries to import zoneinfo._czoneinfo).
  2. The fact that we're not blocking anything when importing zoneinfo multiple times — one or more of the modules might be getting _tzpath from the other one?

I'll try to come up with a minimal reproducer of at least one of the issues so we can try and work through why it's so flaky.

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

1 participant