@@ -65,20 +65,12 @@ def setUp(self):
6565 """
6666 Test is skipped if run with native protocol version <4
6767 """
68- self .support_v5 = True
6968 if PROTOCOL_VERSION < 4 :
7069 raise unittest .SkipTest (
7170 "Native protocol 4,0+ is required for custom payloads, currently using %r"
7271 % (PROTOCOL_VERSION ,))
73- try :
74- self .cluster = Cluster (protocol_version = ProtocolVersion .MAX_SUPPORTED , allow_beta_protocol_version = True )
75- self .session = self .cluster .connect ()
76- except NoHostAvailable :
77- log .info ("Protocol Version 5 not supported," )
78- self .cluster = Cluster (protocol_version = PROTOCOL_VERSION )
79- self .session = self .cluster .connect ()
80- self .support_v5 = False
81-
72+ self .cluster = Cluster (protocol_version = PROTOCOL_VERSION )
73+ self .session = self .cluster .connect ()
8274 self .nodes_currently_failing = []
8375 self .node1 , self .node2 , self .node3 = get_cluster ().nodes .values ()
8476
@@ -157,7 +149,7 @@ def _perform_cql_statement(self, text, consistency_level, expected_exception, se
157149 else :
158150 with self .assertRaises (expected_exception ) as cm :
159151 self .execute_helper (session , statement )
160- if self . support_v5 and (isinstance (cm .exception , WriteFailure ) or isinstance (cm .exception , ReadFailure )):
152+ if ProtocolVersion . uses_error_code_map ( PROTOCOL_VERSION ) and (isinstance (cm .exception , WriteFailure ) or isinstance (cm .exception , ReadFailure )):
161153 if isinstance (cm .exception , ReadFailure ):
162154 self .assertEqual (list (cm .exception .error_code_map .values ())[0 ], 1 )
163155 else :
0 commit comments