@@ -513,16 +513,16 @@ def test_run_in_transaction_w_args_w_kwargs_wo_abort(self):
513
513
def unit_of_work (txn , * args , ** kw ):
514
514
called_with .append ((txn , args , kw ))
515
515
txn .insert (TABLE_NAME , COLUMNS , VALUES )
516
+ return 42
516
517
517
- committed = session .run_in_transaction (
518
+ return_value = session .run_in_transaction (
518
519
unit_of_work , 'abc' , some_arg = 'def' )
519
520
520
- self .assertEqual (committed , now )
521
521
self .assertIsNone (session ._transaction )
522
522
self .assertEqual (len (called_with ), 1 )
523
523
txn , args , kw = called_with [0 ]
524
524
self .assertIsInstance (txn , Transaction )
525
- self .assertEqual (txn . committed , committed )
525
+ self .assertEqual (return_value , 42 )
526
526
self .assertEqual (args , ('abc' ,))
527
527
self .assertEqual (kw , {'some_arg' : 'def' })
528
528
@@ -561,18 +561,15 @@ def test_run_in_transaction_w_abort_no_retry_metadata(self):
561
561
def unit_of_work (txn , * args , ** kw ):
562
562
called_with .append ((txn , args , kw ))
563
563
txn .insert (TABLE_NAME , COLUMNS , VALUES )
564
+ return 'answer'
564
565
565
- committed = session .run_in_transaction (
566
+ return_value = session .run_in_transaction (
566
567
unit_of_work , 'abc' , some_arg = 'def' )
567
568
568
- self .assertEqual (committed , now )
569
569
self .assertEqual (len (called_with ), 2 )
570
570
for index , (txn , args , kw ) in enumerate (called_with ):
571
571
self .assertIsInstance (txn , Transaction )
572
- if index == 1 :
573
- self .assertEqual (txn .committed , committed )
574
- else :
575
- self .assertIsNone (txn .committed )
572
+ self .assertEqual (return_value , 'answer' )
576
573
self .assertEqual (args , ('abc' ,))
577
574
self .assertEqual (kw , {'some_arg' : 'def' })
578
575
@@ -621,17 +618,15 @@ def unit_of_work(txn, *args, **kw):
621
618
time_module = _FauxTimeModule ()
622
619
623
620
with _Monkey (MUT , time = time_module ):
624
- committed = session .run_in_transaction (
625
- unit_of_work , 'abc' , some_arg = 'def' )
621
+ session .run_in_transaction (unit_of_work , 'abc' , some_arg = 'def' )
626
622
627
623
self .assertEqual (time_module ._slept ,
628
624
RETRY_SECONDS + RETRY_NANOS / 1.0e9 )
629
- self .assertEqual (committed , now )
630
625
self .assertEqual (len (called_with ), 2 )
631
626
for index , (txn , args , kw ) in enumerate (called_with ):
632
627
self .assertIsInstance (txn , Transaction )
633
628
if index == 1 :
634
- self .assertEqual (txn .committed , committed )
629
+ self .assertEqual (txn .committed , now )
635
630
else :
636
631
self .assertIsNone (txn .committed )
637
632
self .assertEqual (args , ('abc' ,))
@@ -688,9 +683,8 @@ def unit_of_work(txn, *args, **kw):
688
683
time_module = _FauxTimeModule ()
689
684
690
685
with _Monkey (MUT , time = time_module ):
691
- committed = session .run_in_transaction (unit_of_work )
686
+ session .run_in_transaction (unit_of_work )
692
687
693
- self .assertEqual (committed , now )
694
688
self .assertEqual (time_module ._slept ,
695
689
RETRY_SECONDS + RETRY_NANOS / 1.0e9 )
696
690
self .assertEqual (len (called_with ), 2 )
0 commit comments