@@ -75,7 +75,7 @@ def test_commit_now(self):
7575 name
7676 }}
7777 }}""" .format (uid = uid )
78- resp = self .client .query (query )
78+ resp = self .client .txn ( read_only = True ). query (query )
7979 self .assertEqual ([{'name' : 'Manish' }], json .loads (resp .json ).get ('me' ))
8080
8181 def test_discard (self ):
@@ -98,7 +98,7 @@ def test_discard(self):
9898 name
9999 }}
100100 }}""" .format (uid = uid )
101- resp = self .client .query (query )
101+ resp = self .client .txn ( read_only = True ). query (query )
102102 self .assertEqual ([{'name' : 'Manish' }], json .loads (resp .json ).get ('me' ))
103103
104104 def test_mutate_error (self ):
@@ -143,7 +143,7 @@ def test_read_before_start_ts(self):
143143 }}
144144 }}""" .format (uid = uid )
145145
146- resp = self .client .query (query )
146+ resp = self .client .txn ( read_only = True ). query (query )
147147 self .assertEqual ([], json .loads (resp .json ).get ('me' ))
148148
149149 def test_read_after_start_ts (self ):
@@ -163,7 +163,7 @@ def test_read_after_start_ts(self):
163163 }}
164164 }}""" .format (uid = uid )
165165
166- resp = self .client .query (query )
166+ resp = self .client .txn ( read_only = True ). query (query )
167167 self .assertEqual ([{'name' : 'Manish' }], json .loads (resp .json ).get ('me' ))
168168
169169 def test_read_before_and_after_start_ts (self ):
@@ -197,7 +197,7 @@ def test_read_before_and_after_start_ts(self):
197197 # once txn3 is committed, other txns observe the update
198198 txn3 .commit ()
199199
200- resp4 = self .client .query (query )
200+ resp4 = self .client .txn ( read_only = True ). query (query )
201201 self .assertEqual ([{'name' : 'Manish2' }], json .loads (resp4 .json ).get ('me' ))
202202
203203 def test_read_from_new_client (self ):
@@ -218,7 +218,7 @@ def test_read_from_new_client(self):
218218 }}
219219 }}""" .format (uid = uid )
220220
221- resp2 = client2 .query (query )
221+ resp2 = client2 .txn ( read_only = True ). query (query )
222222 self .assertEqual ([{'name' : 'Manish' }], json .loads (resp2 .json ).get ('me' ))
223223 self .assertTrue (resp2 .txn .start_ts > 0 )
224224
@@ -227,7 +227,7 @@ def test_read_from_new_client(self):
227227 self .assertTrue (assigned .context .start_ts > 0 )
228228 txn2 .commit ()
229229
230- resp = self .client .query (query )
230+ resp = self .client .txn ( read_only = True ). query (query )
231231 self .assertEqual ([{'name' : 'Manish2' }], json .loads (resp .json ).get ('me' ))
232232
233233 def test_read_only_txn (self ):
@@ -236,14 +236,12 @@ def test_read_only_txn(self):
236236
237237 query = '{ me() {} }'
238238
239- # Using client.query helper method
240- resp1 = self .client .query (query )
239+ resp1 = self .client .txn (read_only = True ).query (query )
241240 start_ts1 = resp1 .txn .start_ts
242- resp2 = self .client .query (query )
241+ resp2 = self .client .txn ( read_only = True ). query (query )
243242 start_ts2 = resp2 .txn .start_ts
244243 self .assertEqual (start_ts1 , start_ts2 )
245244
246- # Using client.txn method
247245 txn = self .client .txn (read_only = True )
248246 resp1 = txn .query (query )
249247 start_ts1 = resp1 .txn .start_ts
@@ -361,7 +359,7 @@ def test_commit_conflict(self):
361359 }}
362360 }}""" .format (uid = uid )
363361
364- resp4 = self .client .query (query )
362+ resp4 = self .client .txn ( read_only = True ). query (query )
365363 self .assertEqual ([{'name' : 'Jan the man' }], json .loads (resp4 .json ).get ('me' ))
366364
367365 def test_mutate_conflict (self ):
@@ -408,7 +406,7 @@ def test_conflict_ignore(self):
408406 }
409407 }"""
410408
411- resp = self .client .query (query )
409+ resp = self .client .txn ( read_only = True ). query (query )
412410 self .assertEqual ([{'uid' : uid1 }, {'uid' : uid2 }], json .loads (resp .json ).get ('me' ))
413411
414412 def test_read_index_key_same_txn (self ):
0 commit comments