|
@@ 531-556 (lines=26) @@
|
| 528 |
|
|
| 529 |
|
ACTIONS.pop() |
| 530 |
|
|
| 531 |
|
def test_failing_action(self): |
| 532 |
|
class FailingTestAction(ResultAction): |
| 533 |
|
|
| 534 |
|
def apply(self, *args, **kwargs): |
| 535 |
|
raise RuntimeError("YEAH THAT'S A FAILING BEAR") |
| 536 |
|
|
| 537 |
|
ACTIONS.append(FailingTestAction) |
| 538 |
|
|
| 539 |
|
self.section.append(Setting("default_actions", |
| 540 |
|
"YBear: FailingTestAction")) |
| 541 |
|
ret = autoapply_actions(self.results, |
| 542 |
|
{}, |
| 543 |
|
{}, |
| 544 |
|
self.section, |
| 545 |
|
self.log_printer) |
| 546 |
|
self.assertEqual(ret, self.results) |
| 547 |
|
self.assertEqual(self.log_queue.get().message, |
| 548 |
|
"Failed to execute action 'FailingTestAction'" |
| 549 |
|
" with error: YEAH THAT'S A FAILING BEAR.") |
| 550 |
|
self.assertIn("YEAH THAT'S A FAILING BEAR", |
| 551 |
|
self.log_queue.get().message) |
| 552 |
|
self.assertEqual(self.log_queue.get().message, |
| 553 |
|
"-> for result " + repr(self.resultY) + ".") |
| 554 |
|
self.assertTrue(self.log_queue.empty()) |
| 555 |
|
|
| 556 |
|
ACTIONS.pop() |
| 557 |
|
|
| 558 |
|
|
| 559 |
|
class ProcessingTest_PrintResult(unittest.TestCase): |
|
@@ 504-529 (lines=26) @@
|
| 501 |
|
|
| 502 |
|
ApplyPatchAction.is_applicable = old_is_applicable |
| 503 |
|
|
| 504 |
|
def test_applicable_action(self): |
| 505 |
|
# Use a result whose action can be successfully applied. |
| 506 |
|
log_printer = self.log_printer |
| 507 |
|
|
| 508 |
|
class TestAction(ResultAction): |
| 509 |
|
|
| 510 |
|
def apply(self, *args, **kwargs): |
| 511 |
|
log_printer.debug("ACTION APPLIED SUCCESSFULLY.") |
| 512 |
|
|
| 513 |
|
ACTIONS.append(TestAction) |
| 514 |
|
|
| 515 |
|
self.section.append(Setting("default_actions", "ZBear: TestAction")) |
| 516 |
|
ret = autoapply_actions(self.results, |
| 517 |
|
{}, |
| 518 |
|
{}, |
| 519 |
|
self.section, |
| 520 |
|
log_printer) |
| 521 |
|
self.assertEqual(ret, [self.resultY]) |
| 522 |
|
self.assertEqual(self.log_queue.get().message, |
| 523 |
|
"ACTION APPLIED SUCCESSFULLY.") |
| 524 |
|
self.assertEqual(self.log_queue.get().message, |
| 525 |
|
"Applied 'TestAction' " |
| 526 |
|
"on the whole project from 'ZBear'.") |
| 527 |
|
self.assertTrue(self.log_queue.empty()) |
| 528 |
|
|
| 529 |
|
ACTIONS.pop() |
| 530 |
|
|
| 531 |
|
def test_failing_action(self): |
| 532 |
|
class FailingTestAction(ResultAction): |