@@ -433,6 +433,170 @@ def test_last_fail_subtest__fail_in_subtest(self):
433
433
evaluated_millis = htf_test .VALID_TIMESTAMP ),
434
434
], test_rec .checkpoints )
435
435
436
+ @htf_test .yields_phases
437
+ def test_subtest_previous_fail__fail (self ):
438
+ test_rec = yield htf .Test (
439
+ fail_phase ,
440
+ phase0 ,
441
+ phase_branches .PhaseFailureCheckpoint .subtest_previous (
442
+ 'subtest_previous_fail' , action = htf .PhaseResult .STOP ), error_phase )
443
+
444
+ self .assertTestFail (test_rec )
445
+ self .assertPhasesOutcomeByName (test_record .PhaseOutcome .PASS , test_rec ,
446
+ 'phase0' )
447
+ self .assertPhasesOutcomeByName (test_record .PhaseOutcome .FAIL , test_rec ,
448
+ 'fail_phase' )
449
+
450
+ self .assertEqual ([
451
+ test_record .CheckpointRecord (
452
+ name = 'subtest_previous_fail' ,
453
+ action = htf .PhaseResult .STOP ,
454
+ conditional = phase_branches .PreviousPhases .SUBTEST ,
455
+ subtest_name = None ,
456
+ result = phase_executor .PhaseExecutionOutcome (
457
+ htf .PhaseResult .STOP ),
458
+ evaluated_millis = htf_test .VALID_TIMESTAMP ),
459
+ ], test_rec .checkpoints )
460
+
461
+ @htf_test .yields_phases
462
+ def test_subtest_previous_fail__pass (self ):
463
+ test_rec = yield htf .Test (
464
+ phase0 ,
465
+ phase1 ,
466
+ phase_branches .PhaseFailureCheckpoint .subtest_previous (
467
+ 'subtest_previous_pass' , action = htf .PhaseResult .STOP ), phase2 )
468
+
469
+ self .assertTestPass (test_rec )
470
+ self .assertPhasesOutcomeByName (test_record .PhaseOutcome .PASS , test_rec ,
471
+ 'phase0' , 'phase1' , 'phase2' )
472
+
473
+ self .assertEqual ([
474
+ test_record .CheckpointRecord (
475
+ name = 'subtest_previous_pass' ,
476
+ action = htf .PhaseResult .STOP ,
477
+ conditional = phase_branches .PreviousPhases .SUBTEST ,
478
+ subtest_name = None ,
479
+ result = phase_executor .PhaseExecutionOutcome (
480
+ htf .PhaseResult .CONTINUE ),
481
+ evaluated_millis = htf_test .VALID_TIMESTAMP ),
482
+ ], test_rec .checkpoints )
483
+
484
+ @htf_test .yields_phases
485
+ def test_subtest_previous_fail__fail_in_subtest (self ):
486
+ test_rec = yield htf .Test (
487
+ phase0 ,
488
+ htf .Subtest (
489
+ 'sub' , fail_phase , phase1 ,
490
+ phase_branches .PhaseFailureCheckpoint .subtest_previous (
491
+ 'subtest_previous_fail_in_subtest' , action = htf .PhaseResult .STOP ),
492
+ ),
493
+ error_phase )
494
+
495
+ self .assertTestFail (test_rec )
496
+ self .assertPhasesOutcomeByName (test_record .PhaseOutcome .PASS , test_rec ,
497
+ 'phase0' , 'phase1' )
498
+ self .assertPhasesOutcomeByName (test_record .PhaseOutcome .FAIL , test_rec ,
499
+ 'fail_phase' )
500
+
501
+ self .assertEqual ([
502
+ test_record .CheckpointRecord (
503
+ name = 'subtest_previous_fail_in_subtest' ,
504
+ action = htf .PhaseResult .STOP ,
505
+ conditional = phase_branches .PreviousPhases .SUBTEST ,
506
+ subtest_name = 'sub' ,
507
+ result = phase_executor .PhaseExecutionOutcome (
508
+ htf .PhaseResult .STOP ),
509
+ evaluated_millis = htf_test .VALID_TIMESTAMP ),
510
+ ], test_rec .checkpoints )
511
+
512
+ @htf_test .yields_phases
513
+ def test_subtest_previous_fail__fail_out_of_subtest (self ):
514
+ test_rec = yield htf .Test (
515
+ fail_phase ,
516
+ htf .Subtest (
517
+ 'sub' , phase0 ,
518
+ phase_branches .PhaseFailureCheckpoint .subtest_previous (
519
+ 'subtest_previous_fail_out_of_subtest' , action = htf .PhaseResult .STOP ),
520
+ phase1 ,
521
+ ),
522
+ phase2 )
523
+
524
+ self .assertTestFail (test_rec )
525
+ self .assertPhasesOutcomeByName (test_record .PhaseOutcome .PASS , test_rec ,
526
+ 'phase0' , 'phase1' , 'phase2' )
527
+ self .assertPhasesOutcomeByName (test_record .PhaseOutcome .FAIL , test_rec ,
528
+ 'fail_phase' )
529
+
530
+ self .assertEqual ([
531
+ test_record .CheckpointRecord (
532
+ name = 'subtest_previous_fail_out_of_subtest' ,
533
+ action = htf .PhaseResult .STOP ,
534
+ conditional = phase_branches .PreviousPhases .SUBTEST ,
535
+ subtest_name = 'sub' ,
536
+ result = phase_executor .PhaseExecutionOutcome (
537
+ htf .PhaseResult .CONTINUE ),
538
+ evaluated_millis = htf_test .VALID_TIMESTAMP ),
539
+ ], test_rec .checkpoints )
540
+
541
+ @htf_test .yields_phases
542
+ def test_subtest_previous_fail__pass_in_subtest (self ):
543
+ test_rec = yield htf .Test (
544
+ phase0 ,
545
+ htf .Subtest (
546
+ 'sub' , phase1 ,
547
+ phase_branches .PhaseFailureCheckpoint .subtest_previous (
548
+ 'subtest_previous_pass_in_subtest' , action = htf .PhaseResult .STOP ),
549
+ phase2 ,
550
+ ), phase3 )
551
+
552
+ self .assertTestPass (test_rec )
553
+ self .assertPhasesOutcomeByName (test_record .PhaseOutcome .PASS , test_rec ,
554
+ 'phase0' , 'phase1' , 'phase2' , 'phase3' )
555
+ self .assertPhasesOutcomeByName (test_record .PhaseOutcome .FAIL , test_rec ,
556
+ 'fail_phase' )
557
+
558
+ self .assertEqual ([
559
+ test_record .CheckpointRecord (
560
+ name = 'subtest_previous_pass_in_subtest' ,
561
+ action = htf .PhaseResult .STOP ,
562
+ conditional = phase_branches .PreviousPhases .SUBTEST ,
563
+ subtest_name = 'sub' ,
564
+ result = phase_executor .PhaseExecutionOutcome (
565
+ htf .PhaseResult .CONTINUE ),
566
+ evaluated_millis = htf_test .VALID_TIMESTAMP ),
567
+ ], test_rec .checkpoints )
568
+
569
+ @htf_test .yields_phases
570
+ def test_subtest_previous_fail_subtest__fail_in_subtest (self ):
571
+ test_rec = yield htf .Test (
572
+ phase0 ,
573
+ htf .Subtest (
574
+ 'sub' , fail_phase , phase1 ,
575
+ phase_branches .PhaseFailureCheckpoint .subtest_previous (
576
+ 'subtest_previous_fail_subtest_in_subtest' , action = htf .PhaseResult .FAIL_SUBTEST ),
577
+ skip0 ,
578
+ ),
579
+ phase2 )
580
+
581
+ self .assertTestFail (test_rec )
582
+ self .assertPhasesOutcomeByName (test_record .PhaseOutcome .PASS , test_rec ,
583
+ 'phase0' , 'phase1' , 'phase2' )
584
+ self .assertPhasesOutcomeByName (test_record .PhaseOutcome .FAIL , test_rec ,
585
+ 'fail_phase' )
586
+ self .assertPhasesOutcomeByName (test_record .PhaseOutcome .SKIP , test_rec , 'skip0' )
587
+
588
+ self .assertEqual ([
589
+ test_record .CheckpointRecord (
590
+ name = 'subtest_previous_fail_subtest_in_subtest' ,
591
+ action = htf .PhaseResult .FAIL_SUBTEST ,
592
+ conditional = phase_branches .PreviousPhases .SUBTEST ,
593
+ subtest_name = 'sub' ,
594
+ result = phase_executor .PhaseExecutionOutcome (
595
+ htf .PhaseResult .FAIL_SUBTEST ),
596
+ evaluated_millis = htf_test .VALID_TIMESTAMP ),
597
+ ], test_rec .checkpoints )
598
+
599
+
436
600
@htf_test .yields_phases
437
601
def test_all__no_previous_phases (self ):
438
602
self .test_start_function = None
0 commit comments