|
16 | 16 | # under the License. |
17 | 17 |
|
18 | 18 | import os |
| 19 | +import sys |
19 | 20 | from collections import OrderedDict |
20 | 21 | import io |
21 | 22 | import warnings |
@@ -185,8 +186,7 @@ def __init__(self, *args, **kwargs): |
185 | 186 | pq.read_table(path, partitioning=['week', 'color']) |
186 | 187 | with pytest.raises(ValueError, match="the 'schema' argument"): |
187 | 188 | pq.read_table(path, schema=table.schema) |
188 | | - # Error message varies depending on OS |
189 | | - with pytest.raises(OSError): |
| 189 | + with pytest.raises(ValueError, match="the 'source' argument"): |
190 | 190 | pq.read_table(tempdir) |
191 | 191 | result = pq.read_table(path) |
192 | 192 | assert result == table |
@@ -993,3 +993,13 @@ def test_checksum_write_to_dataset(tempdir): |
993 | 993 | # checksum verification enabled raises an exception |
994 | 994 | with pytest.raises(OSError, match="CRC checksum verification"): |
995 | 995 | _ = pq.read_table(corrupted_file_path, page_checksum_verification=True) |
| 996 | + |
| 997 | + |
| 998 | +@pytest.mark.parametrize( |
| 999 | + "source", ["/tmp/", ["/tmp/file1.parquet", "/tmp/file2.parquet"]]) |
| 1000 | +def test_read_table_raises_value_error_when_ds_is_unavailable(monkeypatch, source): |
| 1001 | + # GH-47728 |
| 1002 | + monkeypatch.setitem(sys.modules, "pyarrow.dataset", None) |
| 1003 | + |
| 1004 | + with pytest.raises(ValueError, match="the 'source' argument"): |
| 1005 | + pq.read_table(source=source) |
0 commit comments