Skip to content

Commit b4f9c5c

Browse files
committed
fix(debugger): correct wrong lineno informations from robot in listener start_(test/suite/keyword) lineno is None
If RobotFramework executes a test case, keyword or so, where the line number is not set internally, i.e. `None`, it generates an empty string for the line number in the listener instead of also passing `None`. This rarely happens, but it does occur. closes #218
1 parent 377d9c5 commit b4f9c5c

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

packages/debugger/src/robotcode/debugger/debugger.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,11 @@ def start_suite(self, name: str, attributes: Dict[str, Any]) -> None:
874874
LOGGER.register_logger(self.debug_logger)
875875

876876
source = attributes.get("source")
877-
line_no = attributes.get("lineno", 1)
877+
line_no_dummy = attributes.get("lineno", 1)
878+
if isinstance(line_no_dummy, str):
879+
line_no = int(line_no_dummy) if line_no_dummy else None
880+
else:
881+
line_no = line_no_dummy
878882
longname = attributes.get("longname", "")
879883
status = attributes.get("status", "")
880884
type = "SUITE"
@@ -931,7 +935,11 @@ def end_suite(self, name: str, attributes: Dict[str, Any]) -> None:
931935

932936
def start_test(self, name: str, attributes: Dict[str, Any]) -> None:
933937
source = attributes.get("source")
934-
line_no = attributes.get("lineno", 1)
938+
line_no_dummy = attributes.get("lineno", 1)
939+
if isinstance(line_no_dummy, str):
940+
line_no = int(line_no_dummy) if line_no_dummy else None
941+
else:
942+
line_no = line_no_dummy
935943
longname = attributes.get("longname", "")
936944
status = attributes.get("status", "")
937945

@@ -983,7 +991,11 @@ def get_current_keyword_handler(self, name: str) -> UserKeywordHandler:
983991
def start_keyword(self, name: str, attributes: Dict[str, Any]) -> None:
984992
status = attributes.get("status", "")
985993
source = attributes.get("source")
986-
line_no = attributes.get("lineno")
994+
line_no_dummy = attributes.get("lineno", 1)
995+
if isinstance(line_no_dummy, str):
996+
line_no = int(line_no_dummy) if line_no_dummy else None
997+
else:
998+
line_no = line_no_dummy
987999
type = attributes.get("type", "KEYWORD")
9881000
libname = attributes.get("libname")
9891001
kwname = attributes.get("kwname")

0 commit comments

Comments
 (0)