|
29 | 29 |
|
30 | 30 |
|
31 | 31 | class AllureListener(object): |
32 | | - def __init__(self): |
| 32 | + def __init__(self, behave_config): |
| 33 | + self.behave_config = behave_config |
33 | 34 | self.logger = AllureReporter() |
34 | 35 | self.current_step_uuid = None |
35 | 36 | self.execution_context = Context() |
@@ -102,19 +103,23 @@ def start_test(self, parent_uuid, uuid, name, parameters, context): |
102 | 103 | @allure_commons.hookimpl |
103 | 104 | def stop_test(self, parent_uuid, uuid, name, context, exc_type, exc_val, exc_tb): |
104 | 105 | scenario = context['scenario'] |
105 | | - self.flush_steps() |
106 | | - status = scenario_status(scenario) |
107 | | - status_details = scenario_status_details(scenario) |
108 | | - test_result = self.logger.get_test(uuid) |
109 | | - test_result.stop = now() |
110 | | - test_result.status = status |
111 | | - test_result.statusDetails = status_details |
112 | | - self.logger.close_test(uuid) |
113 | | - self.current_step_uuid = None |
114 | | - |
115 | | - for group in self.fixture_context.exit(): |
116 | | - group.children.append(uuid) |
117 | | - self.logger.stop_group(group.uuid) |
| 106 | + if scenario.status == 'skipped' and not self.behave_config.show_skipped: |
| 107 | + self.logger.drop_test(uuid) |
| 108 | + else: |
| 109 | + status = scenario_status(scenario) |
| 110 | + status_details = scenario_status_details(scenario) |
| 111 | + |
| 112 | + self.flush_steps() |
| 113 | + test_result = self.logger.get_test(uuid) |
| 114 | + test_result.stop = now() |
| 115 | + test_result.status = status |
| 116 | + test_result.statusDetails = status_details |
| 117 | + self.logger.close_test(uuid) |
| 118 | + self.current_step_uuid = None |
| 119 | + |
| 120 | + for group in self.fixture_context.exit(): |
| 121 | + group.children.append(uuid) |
| 122 | + self.logger.stop_group(group.uuid) |
118 | 123 |
|
119 | 124 | self.execution_context.exit() |
120 | 125 | self.execution_context.append(uuid) |
|
0 commit comments