Skip to content

Commit 1069483

Browse files
committed
🧪 tests: add testcase support foreach stage exec concurrent.
1 parent ba17250 commit 1069483

1 file changed

Lines changed: 79 additions & 43 deletions

File tree

tests/stages/test_stage_foreach.py

Lines changed: 79 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -626,56 +626,92 @@ def test_foreach_stage_exec_concurrent_raise():
626626
},
627627
}
628628
except AssertionError:
629-
assert rs.context == {
630-
"status": FAILED,
631-
"items": [1, 2],
632-
"foreach": {
633-
1: {
634-
"status": FAILED,
635-
"item": 1,
636-
"stages": {
637-
"raise-error": {
638-
"outputs": {},
639-
"errors": {
640-
"name": "ValueError",
641-
"message": "Testing raise error PyStage!!!",
642-
},
643-
"status": FAILED,
644-
}
645-
},
646-
"errors": {
647-
"name": "StageError",
648-
"message": "Item execution was break because its nested-stage, 'raise-error', failed.",
629+
try:
630+
assert rs.context == {
631+
"status": FAILED,
632+
"items": [1, 2],
633+
"foreach": {
634+
1: {
635+
"status": FAILED,
636+
"item": 1,
637+
"stages": {
638+
"raise-error": {
639+
"outputs": {},
640+
"errors": {
641+
"name": "ValueError",
642+
"message": "Testing raise error PyStage!!!",
643+
},
644+
"status": FAILED,
645+
}
646+
},
647+
"errors": {
648+
"name": "StageError",
649+
"message": "Item execution was break because its nested-stage, 'raise-error', failed.",
650+
},
649651
},
650-
},
651-
2: {
652-
"status": CANCEL,
653-
"item": 2,
654-
"stages": {
655-
"raise-error": {"outputs": {}, "status": SKIP},
656-
"echo": {
657-
"outputs": {},
658-
"errors": {
659-
"name": "StageCancelError",
660-
"message": "Execution was canceled from the event before start parallel.",
652+
2: {
653+
"status": CANCEL,
654+
"item": 2,
655+
"stages": {
656+
"raise-error": {"outputs": {}, "status": SKIP},
657+
"echo": {
658+
"outputs": {},
659+
"errors": {
660+
"name": "StageCancelError",
661+
"message": "Execution was canceled from the event before start parallel.",
662+
},
663+
"status": CANCEL,
661664
},
662-
"status": CANCEL,
665+
},
666+
"errors": {
667+
"name": "StageCancelError",
668+
"message": "Item execution was canceled from the event after end item execution.",
663669
},
664670
},
665-
"errors": {
671+
},
672+
"errors": {
673+
2: {
666674
"name": "StageCancelError",
667675
"message": "Item execution was canceled from the event after end item execution.",
668676
},
677+
1: {
678+
"name": "StageError",
679+
"message": "Item execution was break because its nested-stage, 'raise-error', failed.",
680+
},
669681
},
670-
},
671-
"errors": {
672-
2: {
673-
"name": "StageCancelError",
674-
"message": "Item execution was canceled from the event after end item execution.",
682+
}
683+
except AssertionError:
684+
assert rs.context == {
685+
"status": FAILED,
686+
"items": [1, 2],
687+
"errors": {
688+
1: {
689+
"message": (
690+
"Item execution was break because its "
691+
"nested-stage, 'raise-error', failed."
692+
),
693+
"name": "StageError",
694+
},
675695
},
676-
1: {
677-
"name": "StageError",
678-
"message": "Item execution was break because its nested-stage, 'raise-error', failed.",
696+
"foreach": {
697+
1: {
698+
"errors": {
699+
"message": "Item execution was break because its nested-stage, "
700+
"'raise-error', failed.",
701+
"name": "StageError",
702+
},
703+
"item": 1,
704+
"stages": {
705+
"raise-error": {
706+
"errors": {
707+
"message": "Testing raise error PyStage!!!",
708+
"name": "ValueError",
709+
},
710+
"outputs": {},
711+
"status": FAILED,
712+
},
713+
},
714+
"status": FAILED,
715+
},
679716
},
680-
},
681-
}
717+
}

0 commit comments

Comments
 (0)