Skip to content

Re-enable testEqualAmbiguousComparison on Python 3.7+ - #1552

Closed
pacocartones wants to merge 2 commits into
dateutil:masterfrom
pacocartones:reenable-fold-comparison-py37
Closed

Re-enable testEqualAmbiguousComparison on Python 3.7+#1552
pacocartones wants to merge 2 commits into
dateutil:masterfrom
pacocartones:reenable-fold-comparison-py37

Conversation

@pacocartones

Copy link
Copy Markdown

TzFoldMixin.testEqualAmbiguousComparison is skipped unconditionally:

@unittest.skip("Known failure in Python 3.6.")

The failure it guards against was a CPython 3.6-era bug in comparing ambiguous (fold) datetimes across separately-instantiated copies of the same zone (PEP 495 fold semantics), fixed in CPython 3.7+. On every supported modern Python the assertion holds, so the test is dead coverage for six subclasses (GettzTest, ZoneInfoGettzTest, TZRangeTest, TZStrTest, TZICalTest, TzLocalNixTest).

This switches the blanket skip to a version guard so the test runs again on 3.7+ while still skipping on the legacy interpreters CI continues to test:

@unittest.skipIf(sys.version_info < (3, 7), "Known failure in Python 3.6.")

(sys is already imported.) The re-enabled test uses real gettz(...) zone objects, so it exercises the actual fold-comparison path — CI on this PR confirms it passes across the modern matrix.

The test was skipped unconditionally with 'Known failure in Python 3.6.', but
that CPython 3.6-era fold/ambiguous-comparison bug (PEP 495) was fixed in 3.7+.
Switch the blanket skip to skipIf(sys.version_info < (3, 7)) so coverage is
restored on every modern Python while the legacy CI jobs (2.7/3.5/3.6) still skip.
@pganssle pganssle closed this Aug 29, 2026
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

Successfully merging this pull request may close these issues.

2 participants