Skip to content

Commit f920127

Browse files
committed
Fix tests
1 parent 1dc9349 commit f920127

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

robotframework_reportportal/listener.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ def _build_msg_struct(self, message: Dict[str, Any]) -> LogMessage:
150150
else:
151151
msg = LogMessage(message["message"])
152152
msg.level = message["level"]
153-
msg.item_id = self.current_item.rp_item_id
153+
current_item = self.current_item
154+
if current_item:
155+
msg.item_id = current_item.rp_item_id
154156

155157
message_str = msg.message
156158
if is_binary(message_str):

tests/unit/test_model.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
limitations under the License.
1313
"""
1414

15+
from unittest import mock
16+
1517
import pytest
1618

1719
from robotframework_reportportal.model import Keyword
@@ -28,6 +30,8 @@
2830
)
2931
def test_keyword_get_type(kwd_attributes, self_type, parent_type, expected):
3032
"""Test for the get_type() method of the Keyword model."""
31-
kwd = Keyword(name="Test keyword", robot_attributes=kwd_attributes, parent_type=parent_type)
33+
parent = mock.Mock()
34+
parent.type = parent_type
35+
kwd = Keyword(name="Test keyword", robot_attributes=kwd_attributes, parent=parent)
3236
kwd.keyword_type = self_type
3337
assert kwd.get_type() == expected

0 commit comments

Comments
 (0)