1+
12# Copyright DataStax, Inc.
23#
34# Licensed under the Apache License, Version 2.0 (the "License");
@@ -150,7 +151,7 @@ def test_raise_error_on_control_connection_timeout(self):
150151 get_node (1 ).pause ()
151152 cluster = TestCluster (contact_points = ['127.0.0.1' ], connect_timeout = 1 )
152153
153- with self .assertRaisesRegex (NoHostAvailable , "OperationTimedOut\('errors=Timed out creating connection \(1 seconds\)" ):
154+ with self .assertRaisesRegex (NoHostAvailable , r "OperationTimedOut\('errors=Timed out creating connection \(1 seconds\)" ):
154155 cluster .connect ()
155156 cluster .shutdown ()
156157
@@ -899,7 +900,7 @@ def test_profile_load_balancing(self):
899900
900901 # use a copied instance and override the row factory
901902 # assert last returned value can be accessed as a namedtuple so we can prove something different
902- named_tuple_row = rs [ 0 ]
903+ named_tuple_row = rs . one ()
903904 self .assertIsInstance (named_tuple_row , tuple )
904905 self .assertTrue (named_tuple_row .release_version )
905906
@@ -1390,7 +1391,7 @@ def test_simple_nested(self):
13901391 with cluster .connect () as session :
13911392 self .assertFalse (cluster .is_shutdown )
13921393 self .assertFalse (session .is_shutdown )
1393- self .assertTrue (session .execute ('select release_version from system.local' )[ 0 ] )
1394+ self .assertTrue (session .execute ('select release_version from system.local' ). one () )
13941395 self .assertTrue (session .is_shutdown )
13951396 self .assertTrue (cluster .is_shutdown )
13961397
@@ -1428,7 +1429,7 @@ def test_session_no_cluster(self):
14281429 self .assertFalse (cluster .is_shutdown )
14291430 self .assertFalse (session .is_shutdown )
14301431 self .assertFalse (unmanaged_session .is_shutdown )
1431- self .assertTrue (session .execute ('select release_version from system.local' )[ 0 ] )
1432+ self .assertTrue (session .execute ('select release_version from system.local' ). one () )
14321433 self .assertTrue (session .is_shutdown )
14331434 self .assertFalse (cluster .is_shutdown )
14341435 self .assertFalse (unmanaged_session .is_shutdown )
@@ -1567,7 +1568,7 @@ def test_deprecation_warnings_legacy_parameters(self):
15671568
15681569 @test_category logs
15691570 """
1570- with warnings .catch_warnings (record = True ) as w :
1571+ with warnings .catch_warnings (record = True , action = 'once' ) as w :
15711572 TestCluster (load_balancing_policy = RoundRobinPolicy ())
15721573 logging .info (w )
15731574 self .assertGreaterEqual (len (w ), 1 )
@@ -1586,7 +1587,7 @@ def test_deprecation_warnings_meta_refreshed(self):
15861587
15871588 @test_category logs
15881589 """
1589- with warnings .catch_warnings (record = True ) as w :
1590+ with warnings .catch_warnings (record = True , action = 'once' ) as w :
15901591 cluster = TestCluster ()
15911592 cluster .set_meta_refresh_enabled (True )
15921593 logging .info (w )
0 commit comments