@@ -153,13 +153,25 @@ def test_begin_client_side(self, shared_instance, dbapi_database):
153153 conn3 .close ()
154154 assert got_rows == [updated_row ]
155155
156- def test_commit_timestamp_client_side (self ):
156+ def test_commit_timestamp_client_side_transaction (self ):
157157 """Test executing SHOW_COMMIT_TIMESTAMP client side statement in a
158158 transaction."""
159159
160160 self ._cursor .execute (
161161 """
162162 INSERT INTO contacts (contact_id, first_name, last_name, email)
163+ VALUES (1, 'first-name', 'last-name', 'test.email@domen.ru')
164+ """
165+ )
166+ self ._cursor .execute ("SHOW VARIABLE COMMIT_TIMESTAMP" )
167+ got_rows = self ._cursor .fetchall ()
168+ # As the connection is not committed we will get 0 rows
169+ assert len (got_rows ) == 0
170+ assert len (self ._cursor .description ) == 1
171+
172+ self ._cursor .execute (
173+ """
174+ INSERT INTO contacts (contact_id, first_name, last_name, email)
163175 VALUES (2, 'first-name', 'last-name', 'test.email@domen.ru')
164176 """
165177 )
@@ -198,18 +210,33 @@ def test_read_timestamp_client_side(self):
198210 transaction."""
199211
200212 self ._conn .read_only = True
201-
202213 self ._cursor .execute ("SELECT * FROM contacts" )
214+ assert self ._cursor .fetchall () == []
215+
216+ self ._cursor .execute ("SHOW VARIABLE READ_TIMESTAMP" )
217+ read_timestamp_query_result_1 = self ._cursor .fetchall ()
218+
203219 self ._cursor .execute ("SELECT * FROM contacts" )
204- self ._conn .commit ()
220+ assert self ._cursor .fetchall () == []
221+
205222 self ._cursor .execute ("SHOW VARIABLE READ_TIMESTAMP" )
223+ read_timestamp_query_result_2 = self ._cursor .fetchall ()
206224
207- got_rows = self ._cursor .fetchall ()
208- assert len (got_rows ) == 1
209- assert len (got_rows [0 ]) == 1
225+ self ._conn .commit ()
226+
227+ self ._cursor .execute ("SHOW VARIABLE READ_TIMESTAMP" )
228+ read_timestamp_query_result_3 = self ._cursor .fetchall ()
210229 assert len (self ._cursor .description ) == 1
211230 assert self ._cursor .description [0 ].name == "SHOW_READ_TIMESTAMP"
212- assert isinstance (got_rows [0 ][0 ], DatetimeWithNanoseconds )
231+
232+ assert (
233+ read_timestamp_query_result_1
234+ == read_timestamp_query_result_2
235+ == read_timestamp_query_result_3
236+ )
237+ assert len (read_timestamp_query_result_1 ) == 1
238+ assert len (read_timestamp_query_result_1 [0 ]) == 1
239+ assert isinstance (read_timestamp_query_result_1 [0 ][0 ], DatetimeWithNanoseconds )
213240
214241 def test_read_timestamp_client_side_autocommit (self ):
215242 """Test executing SHOW_READ_TIMESTAMP client side statement in a
@@ -225,6 +252,9 @@ def test_read_timestamp_client_side_autocommit(self):
225252 )
226253 self ._conn .read_only = True
227254 self ._cursor .execute ("SELECT * FROM contacts" )
255+ assert self ._cursor .fetchall () == [
256+ (2 , "first-name" , "last-name" , "test.email@domen.ru" )
257+ ]
228258 self ._cursor .execute ("SHOW VARIABLE READ_TIMESTAMP" )
229259
230260 got_rows = self ._cursor .fetchall ()
@@ -725,8 +755,10 @@ def test_read_only(self):
725755 ReadOnly transactions.
726756 """
727757
758+ self ._conn .read_only = True
728759 self ._cursor .execute ("SELECT * FROM contacts" )
729760 self ._conn .commit ()
761+ assert self ._cursor .fetchall () == []
730762
731763 def test_read_only_dml (self ):
732764 """
0 commit comments