Test a mixture of failing and succeeding hooks.
()
| 57 | |
| 58 | |
| 59 | def test_command_chain_dispatcher_fofo(): |
| 60 | """Test a mixture of failing and succeeding hooks.""" |
| 61 | fail1 = Fail("fail1") |
| 62 | fail2 = Fail("fail2") |
| 63 | okay1 = Okay("okay1") |
| 64 | okay2 = Okay("okay2") |
| 65 | |
| 66 | dp = CommandChainDispatcher( |
| 67 | [ |
| 68 | (0, fail1), |
| 69 | # (5, okay1), # add this later |
| 70 | (10, fail2), |
| 71 | (15, okay2), |
| 72 | ] |
| 73 | ) |
| 74 | dp.add(okay1, 5) |
| 75 | |
| 76 | assert dp() == "okay1" |
| 77 | |
| 78 | assert fail1.called is True |
| 79 | assert okay1.called is True |
| 80 | assert fail2.called is False |
| 81 | assert okay2.called is False |
| 82 | |
| 83 | |
| 84 | def test_command_chain_dispatcher_eq_priority(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…