Skip to content

Commit 50eb001

Browse files
GH-50041: [CI][Python] Make test_string_to_tzinfo_pytz_fallback more robust for platforms supporting lower case tz names (#50042)
### Rationale for this change Fix failing test on CI as reported in #50041, for a test added in #49694 ### What changes are included in this PR? The test relies on the lower case "europe/brussels" time zone name not being recognized by `zoneinfo` (and it generally is by `pytz`). But apparently on some platforms, `zoneinfo` does accept this. Updating the test to first test this, and thus skip the test dynamically. * GitHub Issue: #50041 Authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com> Signed-off-by: Raúl Cumplido <raulcumplido@gmail.com>
1 parent 3589dc2 commit 50eb001

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

python/pyarrow/tests/test_types.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -511,11 +511,16 @@ def test_string_to_tzinfo_prefer_zoneinfo_false():
511511
assert result == pytz.FixedOffset(90)
512512

513513

514-
@pytest.mark.skipif(
515-
sys.platform == 'darwin', reason="macOS supports those lower-case names"
516-
)
517514
def test_string_to_tzinfo_pytz_fallback():
518515
pytz = pytest.importorskip("pytz")
516+
517+
try:
518+
zoneinfo.ZoneInfo("europe/brussels")
519+
except zoneinfo.ZoneInfoNotFoundError:
520+
pass
521+
else:
522+
pytest.skip("zoneinfo supports lower-case names on this platform")
523+
519524
result = pa.lib.string_to_tzinfo("europe/brussels")
520525
expected = pytz.timezone("Europe/Brussels")
521526
assert result == expected

0 commit comments

Comments
 (0)