@@ -246,8 +246,8 @@ def test_drop_table(test_catalog: Catalog, table_schema_nested: Schema, table_na
246246@pytest .mark .integration
247247@pytest .mark .parametrize ("test_catalog" , CATALOGS )
248248def test_purge_table (test_catalog : Catalog , table_schema_nested : Schema , table_name : str , database_name : str ) -> None :
249- if isinstance ( test_catalog , HiveCatalog ):
250- pytest .skip ("HiveCatalog does not support purge_table operation yet " )
249+ if not test_catalog . supports_purge_table ( ):
250+ pytest .skip ("Catalog does not support purge_table operation" )
251251
252252 identifier = (database_name , table_name )
253253 test_catalog .create_namespace (database_name )
@@ -299,8 +299,8 @@ def test_update_table_transaction(test_catalog: Catalog, test_schema: Schema, ta
299299@pytest .mark .integration
300300@pytest .mark .parametrize ("test_catalog" , CATALOGS )
301301def test_update_schema_conflict (test_catalog : Catalog , test_schema : Schema , table_name : str , database_name : str ) -> None :
302- if isinstance ( test_catalog , HiveCatalog ):
303- pytest .skip ("HiveCatalog fails in this test, need to investigate " )
302+ if not test_catalog . supports_atomic_concurrent_updates ( ):
303+ pytest .skip ("Catalog does not support atomic concurrent updates " )
304304
305305 identifier = (database_name , table_name )
306306
@@ -646,8 +646,8 @@ def test_rest_custom_namespace_separator(rest_catalog: RestCatalog, table_schema
646646def test_incompatible_partitioned_schema_evolution (
647647 test_catalog : Catalog , test_schema : Schema , test_partition_spec : PartitionSpec , database_name : str , table_name : str
648648) -> None :
649- if isinstance ( test_catalog , HiveCatalog ):
650- pytest .skip ("HiveCatalog does not support schema evolution" )
649+ if not test_catalog . supports_schema_evolution ( ):
650+ pytest .skip (f" { type ( test_catalog ). __name__ } does not support schema evolution" )
651651
652652 identifier = (database_name , table_name )
653653 test_catalog .create_namespace (database_name )
@@ -675,7 +675,7 @@ def test_incompatible_partitioned_schema_evolution(
675675@pytest .mark .integration
676676@pytest .mark .parametrize ("test_catalog" , CATALOGS )
677677def test_namespace_with_slash (test_catalog : Catalog ) -> None :
678- if isinstance ( test_catalog , HiveCatalog ):
678+ if not test_catalog . supports_slash_in_identifier ( ):
679679 pytest .skip (f"{ type (test_catalog ).__name__ } does not support slash in namespace" )
680680
681681 namespace = ("new/db" ,)
@@ -700,8 +700,8 @@ def test_namespace_with_slash(test_catalog: Catalog) -> None:
700700def test_incompatible_sorted_schema_evolution (
701701 test_catalog : Catalog , test_schema : Schema , test_sort_order : SortOrder , database_name : str , table_name : str
702702) -> None :
703- if isinstance ( test_catalog , HiveCatalog ):
704- pytest .skip ("HiveCatalog does not support schema evolution" )
703+ if not test_catalog . supports_schema_evolution ( ):
704+ pytest .skip (f" { type ( test_catalog ). __name__ } does not support schema evolution" )
705705
706706 identifier = (database_name , table_name )
707707 test_catalog .create_namespace (database_name )
@@ -720,7 +720,7 @@ def test_incompatible_sorted_schema_evolution(
720720@pytest .mark .integration
721721@pytest .mark .parametrize ("test_catalog" , CATALOGS )
722722def test_namespace_with_dot (test_catalog : Catalog ) -> None :
723- if isinstance ( test_catalog , ( HiveCatalog , SqlCatalog ) ):
723+ if not test_catalog . supports_dot_in_identifier ( ):
724724 pytest .skip (f"{ type (test_catalog ).__name__ } does not support dot in namespace" )
725725
726726 namespace = ("new.db" ,)
@@ -733,9 +733,8 @@ def test_namespace_with_dot(test_catalog: Catalog) -> None:
733733 test_catalog .create_namespace (namespace )
734734 assert test_catalog .namespace_exists (namespace )
735735
736- # REST Catalog fixture treats this as a hierarchical namespace.
737- # Calling list namespaces will get `new`, not `new.db`.
738- if isinstance (test_catalog , RestCatalog ):
736+ # Hierarchical catalogs might treat this as multiple levels.
737+ if test_catalog .supports_nested_namespaces ():
739738 namespaces = test_catalog .list_namespaces ()
740739 assert ("new" ,) in namespaces or ("new.db" ,) in namespaces
741740 else :
@@ -751,7 +750,7 @@ def test_namespace_with_dot(test_catalog: Catalog) -> None:
751750@pytest .mark .integration
752751@pytest .mark .parametrize ("test_catalog" , CATALOGS )
753752def test_table_name_with_slash (test_catalog : Catalog , table_schema_simple : Schema ) -> None :
754- if isinstance ( test_catalog , ( HiveCatalog , SqlCatalog ) ):
753+ if not test_catalog . supports_slash_in_identifier ( ):
755754 pytest .skip (f"{ type (test_catalog ).__name__ } does not support slash in table name" )
756755
757756 namespace = ("ns_slash" ,)
@@ -778,7 +777,7 @@ def test_table_name_with_slash(test_catalog: Catalog, table_schema_simple: Schem
778777@pytest .mark .integration
779778@pytest .mark .parametrize ("test_catalog" , CATALOGS )
780779def test_table_name_with_dot (test_catalog : Catalog , table_schema_simple : Schema ) -> None :
781- if isinstance ( test_catalog , ( HiveCatalog , SqlCatalog ) ):
780+ if not test_catalog . supports_dot_in_identifier ( ):
782781 pytest .skip (f"{ type (test_catalog ).__name__ } does not support dot in table name" )
783782
784783 namespace = ("ns_dot" ,)
@@ -817,9 +816,6 @@ def test_drop_missing_table(test_catalog: Catalog, database_name: str) -> None:
817816@pytest .mark .integration
818817@pytest .mark .parametrize ("test_catalog" , CATALOGS )
819818def test_drop_nonexistent_namespace (test_catalog : Catalog ) -> None :
820- if isinstance (test_catalog , HiveCatalog ):
821- pytest .skip ("HiveCatalog raises NoSuchObjectException instead of NoSuchNamespaceError" )
822-
823819 namespace = ("non_existent_namespace" ,)
824820 with pytest .raises (NoSuchNamespaceError ):
825821 test_catalog .drop_namespace (namespace )
0 commit comments