|
20 | 20 | import re |
21 | 21 | from functools import wraps |
22 | 22 | from mimetypes import guess_type |
23 | | -from typing import Optional, Dict, Union, Any |
| 23 | +from typing import Optional, Dict, Set, Union, Any |
24 | 24 | from warnings import warn |
25 | 25 |
|
26 | 26 | from reportportal_client.helpers import LifoQueue, is_binary, guess_content_type_from_bytes |
@@ -95,6 +95,7 @@ class listener: |
95 | 95 | _items: LifoQueue |
96 | 96 | _service: Optional[RobotService] |
97 | 97 | _variables: Optional[Variables] |
| 98 | + _remove_keywords: Set[str] = set() |
98 | 99 | ROBOT_LISTENER_API_VERSION = 2 |
99 | 100 |
|
100 | 101 | def __init__(self) -> None: |
@@ -222,6 +223,14 @@ def start_launch(self, attributes: Dict[str, Any], ts: Optional[Any] = None) -> |
222 | 223 | :param attributes: Dictionary passed by the Robot Framework |
223 | 224 | :param ts: Timestamp(used by the ResultVisitor) |
224 | 225 | """ |
| 226 | + try: |
| 227 | + # noinspection PyUnresolvedReferences |
| 228 | + from robot.running.context import EXECUTION_CONTEXTS |
| 229 | + # noinspection PyProtectedMember |
| 230 | + self._remove_keywords = set(EXECUTION_CONTEXTS.current.output._settings.remove_keywords) |
| 231 | + except ImportError: |
| 232 | + warn('Unable to locate Robot Framework context. "removekeywords" feature will not work.', stacklevel=2) |
| 233 | + pass |
225 | 234 | launch = Launch(self.variables.launch_name, attributes, self.variables.launch_attributes) |
226 | 235 | launch.doc = self.variables.launch_doc or launch.doc |
227 | 236 | if self.variables.pabot_used and not self._variables.launch_id: |
|
0 commit comments