Skip to content

Commit 177ec45

Browse files
authored
GH-47778: [CI][Python] Remove ORC alias timezone for US/Pacific on test_orc.py::test_timezone_absent (#47956)
### Rationale for this change Since we upgraded to ORC 2.1.1 our test started failing because it was able to resolved the timezone and read the file when we were expecting an exception to be raised. In order to support Legacy timezones ORC added some aliases to some timezones, in the case of our test `US/Pacific` was aliased to `America/Los_Angeles` and the test was finding the timezone. ### What changes are included in this PR? Remove both timezones `US/Pacific` and `America/Los_Angeles` so the test works as expected. ### Are these changes tested? Yes, locally via CI and some extra archery tasks ### Are there any user-facing changes? No * GitHub Issue: #47778 Authored-by: Raúl Cumplido <[email protected]> Signed-off-by: Raúl Cumplido <[email protected]>
1 parent 00245cc commit 177ec45

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

python/pyarrow/tests/test_orc.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,12 @@ def test_timezone_absent(datadir, tmpdir):
177177
shutil.copytree(source_tzdir, tzdir, symlinks=True)
178178
except OSError as e:
179179
pytest.skip(f"Failed to copy timezone database: {e}")
180+
# ORC 2.1.1 Creates an alias between some legacy Timezones
181+
# https://github.com/apache/orc/pull/2422
182+
# Example US/Pacific -> America/Los_Angeles
183+
# Remove both to simulate missing timezone and avoid alias resolution
180184
(tzdir / 'US' / 'Pacific').unlink(missing_ok=True)
185+
(tzdir / 'America' / 'Los_Angeles').unlink(missing_ok=True)
181186

182187
path = datadir / 'TestOrcFile.testDate1900.orc'
183188
code = f"""if 1:
@@ -189,7 +194,8 @@ def test_timezone_absent(datadir, tmpdir):
189194
try:
190195
orc_file.read()
191196
except Exception as e:
192-
assert "zoneinfo/US/Pacific" in str(e), e
197+
timezones = ["zoneinfo/US/Pacific", "zoneinfo/America/Los_Angeles"]
198+
assert any(tz in str(e) for tz in timezones), e
193199
else:
194200
assert False, "Should have raised exception"
195201
"""

0 commit comments

Comments
 (0)