Skip to content

Commit

Permalink
chore: commentary about exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Aug 4, 2024
1 parent fed798a commit 56e3ed2
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions ibis/backends/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1656,24 +1656,28 @@ def test_no_accidental_cross_database_table_load(con_create_database):

con.drop_table(table)

# Now attempting to load same table name without specifying db should fail
allowed_exceptions = (
com.IbisError,
*tuple(
filter(
None,
(
ClickHouseDatabaseError,
PySparkAnalysisException,
MySQLProgrammingError,
ExaQueryError,
),
)
# these exception types are None when the backend dependency that
# defines them is not installed
*filter(
None,
(
ClickHouseDatabaseError,
PySparkAnalysisException,
MySQLProgrammingError,
ExaQueryError,
),
),
# datafusion really needs to get their exception story in order
#
# we only want to allow base Exception when we're testing datafusion
# otherwise any exceptions, including those that are unrelated to the
# problem under test will be considered correctly raising
*((Exception,) * (con.name == "datafusion")),
)

# Now attempting to load same table name without specifying db should fail
with pytest.raises(allowed_exceptions):
t = con.table(table)

Expand Down

0 comments on commit 56e3ed2

Please sign in to comment.