Skip to content

Commit 4db8d75

Browse files
committed
Add removekeywords config import
1 parent 5f4515a commit 4db8d75

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

robotframework_reportportal/listener.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import re
2121
from functools import wraps
2222
from mimetypes import guess_type
23-
from typing import Optional, Dict, Union, Any
23+
from typing import Optional, Dict, Set, Union, Any
2424
from warnings import warn
2525

2626
from reportportal_client.helpers import LifoQueue, is_binary, guess_content_type_from_bytes
@@ -95,6 +95,7 @@ class listener:
9595
_items: LifoQueue
9696
_service: Optional[RobotService]
9797
_variables: Optional[Variables]
98+
_remove_keywords: Set[str] = set()
9899
ROBOT_LISTENER_API_VERSION = 2
99100

100101
def __init__(self) -> None:
@@ -222,6 +223,14 @@ def start_launch(self, attributes: Dict[str, Any], ts: Optional[Any] = None) ->
222223
:param attributes: Dictionary passed by the Robot Framework
223224
:param ts: Timestamp(used by the ResultVisitor)
224225
"""
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
225234
launch = Launch(self.variables.launch_name, attributes, self.variables.launch_attributes)
226235
launch.doc = self.variables.launch_doc or launch.doc
227236
if self.variables.pabot_used and not self._variables.launch_id:

0 commit comments

Comments
 (0)