|
| 1 | +from __future__ import annotations |
| 2 | + |
| 3 | +import pytest |
| 4 | + |
| 5 | +import ibis.common.exceptions as com |
| 6 | +from ibis.backends.tests.errors import MySQLOperationalError |
| 7 | + |
| 8 | + |
| 9 | +def combine_marks(marks: list) -> callable: |
| 10 | + def decorator(func): |
| 11 | + for mark in reversed(marks): |
| 12 | + func = mark(func) |
| 13 | + return func |
| 14 | + |
| 15 | + return decorator |
| 16 | + |
| 17 | + |
| 18 | +NO_ARRAY_SUPPORT_MARKS = [ |
| 19 | + pytest.mark.never( |
| 20 | + ["sqlite", "mysql", "exasol"], reason="No array support", raises=Exception |
| 21 | + ), |
| 22 | + pytest.mark.never( |
| 23 | + ["mssql"], |
| 24 | + reason="No array support", |
| 25 | + raises=( |
| 26 | + com.UnsupportedBackendType, |
| 27 | + com.OperationNotDefinedError, |
| 28 | + AssertionError, |
| 29 | + ), |
| 30 | + ), |
| 31 | + pytest.mark.never( |
| 32 | + ["mysql"], |
| 33 | + reason="No array support", |
| 34 | + raises=( |
| 35 | + com.UnsupportedBackendType, |
| 36 | + com.OperationNotDefinedError, |
| 37 | + MySQLOperationalError, |
| 38 | + ), |
| 39 | + ), |
| 40 | + pytest.mark.notyet( |
| 41 | + ["impala"], |
| 42 | + reason="No array support", |
| 43 | + raises=( |
| 44 | + com.UnsupportedBackendType, |
| 45 | + com.OperationNotDefinedError, |
| 46 | + com.TableNotFound, |
| 47 | + ), |
| 48 | + ), |
| 49 | + pytest.mark.notimpl(["druid", "oracle"], raises=Exception), |
| 50 | +] |
| 51 | +NO_ARRAY_SUPPORT = combine_marks(NO_ARRAY_SUPPORT_MARKS) |
| 52 | + |
| 53 | + |
| 54 | +NO_STRUCT_SUPPORT_MARKS = [ |
| 55 | + pytest.mark.never(["mysql", "sqlite", "mssql"], reason="No struct support"), |
| 56 | + pytest.mark.notyet(["impala"]), |
| 57 | + pytest.mark.notimpl(["druid", "oracle", "exasol"]), |
| 58 | +] |
| 59 | +NO_STRUCT_SUPPORT = combine_marks(NO_STRUCT_SUPPORT_MARKS) |
| 60 | + |
| 61 | +NO_MAP_SUPPORT_MARKS = [ |
| 62 | + pytest.mark.never( |
| 63 | + ["sqlite", "mysql", "mssql"], reason="Unlikely to ever add map support" |
| 64 | + ), |
| 65 | + pytest.mark.notyet( |
| 66 | + ["bigquery", "impala"], reason="Backend doesn't yet implement map types" |
| 67 | + ), |
| 68 | + pytest.mark.notimpl( |
| 69 | + ["exasol", "polars", "druid", "oracle"], |
| 70 | + reason="Not yet implemented in ibis", |
| 71 | + ), |
| 72 | +] |
| 73 | +NO_MAP_SUPPORT = combine_marks(NO_MAP_SUPPORT_MARKS) |
| 74 | + |
| 75 | +NO_JSON_SUPPORT_MARKS = [ |
| 76 | + pytest.mark.never(["impala"], reason="doesn't support JSON and never will"), |
| 77 | + pytest.mark.notyet(["clickhouse"], reason="upstream is broken"), |
| 78 | + pytest.mark.notimpl(["datafusion", "exasol", "mssql", "druid", "oracle"]), |
| 79 | +] |
| 80 | +NO_JSON_SUPPORT = combine_marks(NO_JSON_SUPPORT_MARKS) |
0 commit comments