|
18 | 18 | from sqlmesh.core.engine_adapter.shared import DataObject |
19 | 19 | from sqlmesh.utils import nullsafe_join |
20 | 20 | from sqlmesh.utils.date import to_ds |
| 21 | +from sqlmesh.utils.errors import UnsupportedCatalogOperationError |
21 | 22 | from sqlmesh.utils.pydantic import PydanticModel |
22 | 23 |
|
23 | 24 | if t.TYPE_CHECKING: |
@@ -281,7 +282,10 @@ def ctx(engine_adapter, test_type): |
281 | 282 |
|
282 | 283 |
|
283 | 284 | def test_catalog_operations(ctx: TestContext): |
284 | | - if ctx.dialect in {"mysql", "redshift", "postgres"}: |
| 285 | + if ( |
| 286 | + ctx.engine_adapter.CATALOG_SUPPORT.is_unsupported |
| 287 | + or ctx.engine_adapter.CATALOG_SUPPORT.is_single_catalog_only |
| 288 | + ): |
285 | 289 | pytest.skip( |
286 | 290 | f"Engine adapter {ctx.engine_adapter.dialect} doesn't support catalog operations" |
287 | 291 | ) |
@@ -363,7 +367,13 @@ def create_objects_and_validate(schema_name: str): |
363 | 367 | catalog_name = "tobiko-test" |
364 | 368 |
|
365 | 369 | schema = ctx.schema("drop_schema_catalog_test", catalog_name) |
366 | | - drop_schema_and_validate(schema) |
| 370 | + if ctx.engine_adapter.CATALOG_SUPPORT.is_single_catalog_only: |
| 371 | + with pytest.raises( |
| 372 | + UnsupportedCatalogOperationError, |
| 373 | + match=".*requires that all catalog operations be against a single catalog.*", |
| 374 | + ): |
| 375 | + drop_schema_and_validate(schema) |
| 376 | + return |
367 | 377 | create_objects_and_validate(schema) |
368 | 378 | drop_schema_and_validate(schema) |
369 | 379 |
|
|
0 commit comments