| 146 | |
| 147 | |
| 148 | def test_timezone_database_absent(datadir): |
| 149 | # Example file relies on the timezone "US/Pacific". It should gracefully |
| 150 | # fail, not crash, if the timezone database is not found. |
| 151 | path = datadir / 'TestOrcFile.testDate1900.orc' |
| 152 | code = f"""if 1: |
| 153 | import os |
| 154 | os.environ['TZDIR'] = '/tmp/non_existent' |
| 155 | |
| 156 | from pyarrow import orc |
| 157 | try: |
| 158 | orc_file = orc.ORCFile({str(path)!r}) |
| 159 | orc_file.read() |
| 160 | except Exception as e: |
| 161 | assert "time zone database" in str(e).lower(), e |
| 162 | else: |
| 163 | assert False, "Should have raised exception" |
| 164 | """ |
| 165 | subprocess.run([sys.executable, "-c", code], check=True) |
| 166 | |
| 167 | |
| 168 | def test_timezone_absent(datadir, tmpdir): |