3030import string
3131import threading
3232import time
33- import unittest
3433
3534import oracledb
3635import test_env
@@ -84,7 +83,7 @@ def test_1100(self):
8483 )
8584 self .assertEqual (conn .thin , test_env .get_is_thin ())
8685
87- @unittest . skipIf ( test_env .get_is_drcp (), "not supported with DRCP" )
86+ @test_env .skip_if_drcp ( )
8887 def test_1101 (self ):
8988 "1101 - test use of application context"
9089 namespace = "CLIENTCONTEXT"
@@ -175,7 +174,7 @@ def test_1106(self):
175174 password = test_env .get_main_password () + "X"
176175 )
177176
178- @unittest . skipIf ( test_env .get_is_drcp (), "not supported with DRCP" )
177+ @test_env .skip_if_drcp ( )
179178 def test_1107 (self ):
180179 "1107 - test changing password"
181180 conn = test_env .get_connection ()
@@ -189,7 +188,7 @@ def test_1107(self):
189188 conn = test_env .get_connection (password = new_password )
190189 conn .changepassword (new_password , test_env .get_main_password ())
191190
192- @unittest . skipIf ( test_env .get_is_drcp (), "not supported with DRCP" )
191+ @test_env .skip_if_drcp ( )
193192 def test_1108 (self ):
194193 "1108 - test changing password to an invalid value"
195194 conn = test_env .get_connection ()
@@ -201,7 +200,7 @@ def test_1108(self):
201200 with self .assertRaisesFullCode ("ORA-01017" , "ORA-00988" , "ORA-28008" ):
202201 conn .changepassword ("incorrect old password" , new_password )
203202
204- @unittest . skipIf ( test_env .get_is_drcp (), "not supported with DRCP" )
203+ @test_env .skip_if_drcp ( )
205204 def test_1109 (self ):
206205 "1109 - test connecting with password containing / and @ symbols"
207206 conn = test_env .get_connection ()
@@ -227,7 +226,7 @@ def test_1110(self):
227226 with self .assertRaisesFullCode ("DPY-1001" ):
228227 conn .rollback ()
229228
230- @unittest . skipIf ( test_env .get_is_thin (), "not relevant for thin mode" )
229+ @test_env .skip_unless_thick_mode ( )
231230 def test_1111 (self ):
232231 "1111 - test creating a connection using a handle"
233232 conn = test_env .get_connection ()
@@ -370,10 +369,7 @@ def test_1120(self):
370369 self .conn .ping ()
371370 self .assertRoundTrips (1 )
372371
373- @unittest .skipIf (
374- test_env .get_is_thin (),
375- "thin mode doesn't support two-phase commit yet" ,
376- )
372+ @test_env .skip_unless_thick_mode ()
377373 def test_1121 (self ):
378374 "1121 - test begin, prepare, cancel transaction"
379375 conn = test_env .get_connection ()
@@ -395,10 +391,7 @@ def test_1121(self):
395391 (count ,) = cursor .fetchone ()
396392 self .assertEqual (count , 0 )
397393
398- @unittest .skipIf (
399- test_env .get_is_thin (),
400- "thin mode doesn't support two-phase commit yet" ,
401- )
394+ @test_env .skip_unless_thick_mode ()
402395 def test_1122 (self ):
403396 "1122 - test multiple transactions on the same connection"
404397 conn = test_env .get_connection ()
@@ -438,10 +431,7 @@ def test_1122(self):
438431 cursor .execute ("select IntCol, StringCol1 from TestTempTable" )
439432 self .assertEqual (cursor .fetchall (), expected_rows )
440433
441- @unittest .skipIf (
442- test_env .get_is_thin (),
443- "thin mode doesn't support two-phase commit yet" ,
444- )
434+ @test_env .skip_unless_thick_mode ()
445435 def test_1123 (self ):
446436 "1123 - test multiple global transactions on the same connection"
447437 conn = test_env .get_connection ()
@@ -499,10 +489,7 @@ def test_1123(self):
499489 cursor .execute ("select IntCol, StringCol1 from TestTempTable" )
500490 self .assertEqual (cursor .fetchall (), expected_rows )
501491
502- @unittest .skipIf (
503- test_env .get_is_thin (),
504- "thin mode doesn't support two-phase commit yet" ,
505- )
492+ @test_env .skip_unless_thick_mode ()
506493 def test_1124 (self ):
507494 "1124 - test creating global txn after a local txn"
508495 conn = test_env .get_connection ()
@@ -562,7 +549,7 @@ def perform_cancel():
562549 (user ,) = cursor .fetchone ()
563550 self .assertEqual (user , test_env .get_main_user ().upper ())
564551
565- @unittest . skipIf ( test_env .get_is_drcp (), "not supported with DRCP" )
552+ @test_env .skip_if_drcp ( )
566553 def test_1127 (self ):
567554 "1127 - test changing password during connect"
568555 conn = test_env .get_connection ()
@@ -625,7 +612,7 @@ def test_1130(self):
625612 cursor .callproc ("dbms_output.get_line" , (string_var , number_var ))
626613 self .assertEqual (string_var .getvalue (), test_string )
627614
628- @unittest . skipUnless ( test_env .has_client_version ( 18 ), "unsupported client" )
615+ @test_env .skip_unless_call_timeout_supported ( )
629616 def test_1131 (self ):
630617 "1131 - test connection call_timeout"
631618 conn = test_env .get_connection ()
@@ -694,18 +681,15 @@ def test_1135(self):
694681 (instance_name ,) = cursor .fetchone ()
695682 self .assertEqual (conn .instance_name .upper (), instance_name )
696683
697- @unittest .skipUnless (
698- test_env .has_client_version (18 ), "not supported on this client"
699- )
684+ @test_env .skip_unless_call_timeout_supported ()
700685 def test_1136 (self ):
701686 "1136 - test deprecated attributes"
702687 conn = test_env .get_connection ()
703688 conn .callTimeout = 500
704689 self .assertEqual (conn .callTimeout , 500 )
705690
706- @unittest .skipIf (test_env .get_is_drcp (), "not supported with DRCP" )
707- @unittest .skipUnless (test_env .has_server_version (23 ), "unsupported server" )
708- @unittest .skipUnless (test_env .has_client_version (23 ), "unsupported client" )
691+ @test_env .skip_if_drcp ()
692+ @test_env .skip_unless_long_passwords_supported ()
709693 def test_1137 (self ):
710694 "1137 - test maximum allowed length for password"
711695 conn = test_env .get_connection ()
@@ -784,9 +768,7 @@ def test_1143(self):
784768 self .assertEqual (conn .username , test_env .get_main_user ())
785769 self .assertEqual (conn .proxy_user , proxy_user )
786770
787- @unittest .skipIf (
788- not test_env .get_is_thin (), "thick mode doesn't support SDU yet"
789- )
771+ @test_env .skip_unless_thin_mode ()
790772 def test_1144 (self ):
791773 "1144 - test connection.sdu"
792774 conn = test_env .get_connection ()
@@ -799,10 +781,7 @@ def test_1145(self):
799781 with self .assertRaisesFullCode ("DPY-2023" ):
800782 test_env .get_connection (conn_class = oracledb .ConnectionPool )
801783
802- @unittest .skipUnless (
803- test_env .get_is_thin (),
804- "thick mode doesn't support program yet" ,
805- )
784+ @test_env .skip_unless_thin_mode ()
806785 def test_1146 (self ):
807786 "1146 - test passing program when creating a connection"
808787 sql = (
@@ -811,10 +790,7 @@ def test_1146(self):
811790 )
812791 self .__verify_connect_arg ("program" , "newprogram" , sql )
813792
814- @unittest .skipUnless (
815- test_env .get_is_thin (),
816- "thick mode doesn't support machine yet" ,
817- )
793+ @test_env .skip_unless_thin_mode ()
818794 def test_1147 (self ):
819795 "1147 - test passing machine when creating a connection"
820796 sql = (
@@ -823,10 +799,7 @@ def test_1147(self):
823799 )
824800 self .__verify_connect_arg ("machine" , "newmachine" , sql )
825801
826- @unittest .skipUnless (
827- test_env .get_is_thin (),
828- "thick mode doesn't support terminal yet" ,
829- )
802+ @test_env .skip_unless_thin_mode ()
830803 def test_1148 (self ):
831804 "1148 - test passing terminal when creating a connection"
832805 sql = (
@@ -835,10 +808,7 @@ def test_1148(self):
835808 )
836809 self .__verify_connect_arg ("terminal" , "newterminal" , sql )
837810
838- @unittest .skipUnless (
839- test_env .get_is_thin (),
840- "thick mode doesn't support osuser yet" ,
841- )
811+ @test_env .skip_unless_thin_mode ()
842812 def test_1149 (self ):
843813 "1149 - test passing osuser when creating a connection"
844814 sql = (
@@ -855,9 +825,7 @@ def test_1150(self):
855825 )
856826 self .__verify_connect_arg ("driver_name" , "newdriver" , sql )
857827
858- @unittest .skipUnless (
859- test_env .get_is_thin (), "thick mode doesn't support session_id yet"
860- )
828+ @test_env .skip_unless_thin_mode ()
861829 def test_1151 (self ):
862830 "1151 - test getting session id"
863831 conn = test_env .get_connection ()
@@ -866,9 +834,7 @@ def test_1151(self):
866834 (fetched_value ,) = cursor .fetchone ()
867835 self .assertEqual (conn .session_id , fetched_value )
868836
869- @unittest .skipUnless (
870- test_env .get_is_thin (), "thick mode doesn't support serial_num yet"
871- )
837+ @test_env .skip_unless_thin_mode ()
872838 def test_1152 (self ):
873839 "1152 - test getting session serial number"
874840 conn = test_env .get_connection ()
@@ -879,10 +845,7 @@ def test_1152(self):
879845 (fetched_value ,) = cursor .fetchone ()
880846 self .assertEqual (conn .serial_num , fetched_value )
881847
882- @unittest .skipUnless (
883- test_env .get_is_thin (),
884- "thick mode doesn't support registered protocols" ,
885- )
848+ @test_env .skip_unless_thin_mode ()
886849 def test_1153 (self ):
887850 "1153 - test passed params in hook with standalone connection"
888851 sdu = 4096
0 commit comments