@@ -657,6 +657,13 @@ def tearDown(self):
657657 for table in self .tables_to_delete :
658658 table .delete ()
659659
660+ def _skip_if_emulated (self , message ):
661+ # NOTE: This method is necessary because ``Config.IN_EMULATOR``
662+ # is set at runtime rather than import time, which means we
663+ # can't use the @unittest.skipIf decorator.
664+ if Config .IN_EMULATOR :
665+ self .skipTest (message )
666+
660667 def test_list_tables (self ):
661668 # Since `Config.INSTANCE_DATA` is newly created in `setUpModule`, the
662669 # table created in `setUpClass` here will be the only one.
@@ -691,6 +698,7 @@ def test_create_table(self):
691698 self .assertEqual (sorted_tables , expected_tables )
692699
693700 def test_test_iam_permissions (self ):
701+ self ._skip_if_emulated ("Method not implemented in bigtable emulator" )
694702 temp_table_id = "test-test-iam-policy-table"
695703 temp_table = Config .INSTANCE_DATA .table (temp_table_id )
696704 temp_table .create ()
@@ -701,6 +709,7 @@ def test_test_iam_permissions(self):
701709 self .assertEqual (permissions , permissions_allowed )
702710
703711 def test_get_iam_policy (self ):
712+ self ._skip_if_emulated ("Method not implemented in bigtable emulator" )
704713 temp_table_id = "test-get-iam-policy-table"
705714 temp_table = Config .INSTANCE_DATA .table (temp_table_id )
706715 temp_table .create ()
@@ -711,6 +720,7 @@ def test_get_iam_policy(self):
711720 self .assertEqual (policy ["version" ], 0 )
712721
713722 def test_set_iam_policy (self ):
723+ self ._skip_if_emulated ("Method not implemented in bigtable emulator" )
714724 temp_table_id = "test-set-iam-policy-table"
715725 temp_table = Config .INSTANCE_DATA .table (temp_table_id )
716726 temp_table .create ()
@@ -742,6 +752,7 @@ def test_create_table_with_families(self):
742752 self .assertEqual (retrieved_col_fam .gc_rule , gc_rule )
743753
744754 def test_create_table_with_split_keys (self ):
755+ self ._skip_if_emulated ("Split keys are not supported by Bigtable emulator" )
745756 temp_table_id = "foo-bar-baz-split-table"
746757 initial_split_keys = [b"split_key_1" , b"split_key_10" , b"split_key_20" ]
747758 temp_table = Config .INSTANCE_DATA .table (temp_table_id )
@@ -1014,6 +1025,9 @@ def test_yield_rows_with_row_set(self):
10141025 self .assertEqual (found_row_keys , expected_row_keys )
10151026
10161027 def test_read_large_cell_limit (self ):
1028+ self ._maybe_emulator_skip (
1029+ "Maximum gRPC received message size for emulator is 4194304 bytes."
1030+ )
10171031 row = self ._table .row (ROW_KEY )
10181032 self .rows_to_delete .append (row )
10191033
0 commit comments