Skip to content

Commit

Permalink
Relax test
Browse files Browse the repository at this point in the history
  • Loading branch information
pitrou committed Dec 17, 2024
1 parent 9309291 commit 1251958
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions python/pyarrow/tests/test_orc.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ def test_timezone_database_absent(datadir):
from pyarrow import orc
try:
orc_file = orc.ORCFile({str(path)!r})
orc_file.read()
except Exception as e:
assert "time zone database" in str(e).lower(), e
else:
Expand All @@ -172,22 +173,23 @@ def test_timezone_absent(datadir, tmpdir):
if not source_tzdir.exists():
pytest.skip(f"Test needs timezone database in {source_tzdir}")
tzdir = Path(tmpdir / 'zoneinfo')
shutil.copytree(source_tzdir, tzdir, symlinks=True)
try:
shutil.copytree(source_tzdir, tzdir, symlinks=True)
except OSError as e:
pytest.skip(f"Failed to copy timezone database: {e}")
(tzdir / 'US' / 'Pacific').unlink(missing_ok=True)

path = datadir / 'TestOrcFile.testDate1900.orc'
code = f"""if 1:
import os
import re
os.environ['TZDIR'] = {str(tzdir)!r}
from pyarrow import orc
orc_file = orc.ORCFile({str(path)!r})
try:
orc_file.read()
except Exception as e:
assert re.search(
"Can't open .*/zoneinfo/US/Pacific", str(e), flags=re.I), e
assert "zoneinfo/US/Pacific" in str(e), e
else:
assert False, "Should have raised exception"
"""
Expand Down

0 comments on commit 1251958

Please sign in to comment.