Skip to content

Commit dff0b59

Browse files
committed
🧪 tests: update testcase that able dynamic expectation.
1 parent 1d51a23 commit dff0b59

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

tests/stages/test_stage_foreach.py

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,65 @@ def test_foreach_stage_exec_raise_full():
458458
possible.append(True)
459459
except AssertionError:
460460
possible.append(False)
461+
try:
462+
assert rs.context == {
463+
"status": FAILED,
464+
"items": [1, 2],
465+
"foreach": {
466+
2: {
467+
"status": FAILED,
468+
"item": 2,
469+
"stages": {
470+
"2709471980": {"outputs": {}, "status": SUCCESS},
471+
"9263488742": {
472+
"outputs": {},
473+
"errors": {
474+
"name": "StageError",
475+
"message": "Raise for item equal 2",
476+
},
477+
"status": FAILED,
478+
},
479+
},
480+
"errors": {
481+
"name": "StageError",
482+
"message": "Break item: 2 because nested stage: 'Final Echo', failed.",
483+
},
484+
},
485+
1: {
486+
"status": CANCEL,
487+
"item": 1,
488+
"stages": {
489+
"2709471980": {"outputs": {}, "status": SUCCESS},
490+
"9263488742": {"outputs": {}, "status": SKIP},
491+
"2238460182": {
492+
"outputs": {},
493+
"errors": {
494+
"name": "StageCancelError",
495+
"message": "Cancel before start empty process.",
496+
},
497+
"status": CANCEL,
498+
},
499+
},
500+
"errors": {
501+
"name": "StageCancelError",
502+
"message": "Cancel item: 1 after end nested process.",
503+
},
504+
},
505+
},
506+
"errors": {
507+
2: {
508+
"name": "StageError",
509+
"message": "Break item: 2 because nested stage: 'Final Echo', failed.",
510+
},
511+
1: {
512+
"name": "StageCancelError",
513+
"message": "Cancel item: 1 after end nested process.",
514+
},
515+
},
516+
}
517+
possible.append(True)
518+
except AssertionError:
519+
possible.append(False)
461520
if not any(possible):
462521
print(rs.context)
463522
raise AssertionError("checking context does not match any case.")

0 commit comments

Comments
 (0)