Skip to content

Commit

Permalink
RF Interfaces: conform to pydantic models
Browse files Browse the repository at this point in the history
While implementing validation for Oxygen's handler result dictionaries, it was
found out that RobotInterface.running assumed result dictionaries would have
fields that are not, in fact, mandatory. Thus, add robust attribute handling
to both RF3- and RF4 interfaces.
  • Loading branch information
Tattoo committed Oct 27, 2023
1 parent e068104 commit 2da31da
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/oxygen/robot3_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ def create_wrapper_keyword(self,
class RobotRunningInterface(object):
def build_suite(self, parsed_results):
robot_root_suite = RobotRunningSuite(parsed_results['name'])
for parsed_suite in parsed_results['suites']:
for parsed_suite in parsed_results.get('suites', []):
robot_suite = robot_root_suite.suites.create(parsed_suite['name'])
for subsuite in parsed_suite.get('suites', []):
robot_subsuite = self.build_suite(subsuite)
Expand All @@ -355,9 +355,9 @@ def build_suite(self, parsed_results):
def build_tests(self, oxygen_suite, robot_suite):
for parsed_test in oxygen_suite.get('tests', []):
name = parsed_test['name']
tags = parsed_test['tags']
tags = parsed_test.get('tags', [])
kw = parsed_test['keywords'][0]
msg = '\n'.join(kw['messages'])
msg = '\n'.join(kw.get('messages', []))
test_robot_counterpart = robot_suite.tests.create(name, tags=tags)
if kw['pass']:
args = [msg if msg else 'Test passed :D']
Expand Down
6 changes: 3 additions & 3 deletions src/oxygen/robot4_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ def create_wrapper_keyword(self,
class RobotRunningInterface(object):
def build_suite(self, parsed_results):
robot_root_suite = RobotRunningSuite(parsed_results['name'])
for parsed_suite in parsed_results['suites']:
for parsed_suite in parsed_results.get('suites', []):
robot_suite = robot_root_suite.suites.create(parsed_suite['name'])
for subsuite in parsed_suite.get('suites', []):
robot_subsuite = self.build_suite(subsuite)
Expand All @@ -355,9 +355,9 @@ def build_suite(self, parsed_results):
def build_tests(self, oxygen_suite, robot_suite):
for parsed_test in oxygen_suite.get('tests', []):
name = parsed_test['name']
tags = parsed_test['tags']
tags = parsed_test.get('tags', [])
kw = parsed_test['keywords'][0]
msg = '\n'.join(kw['messages'])
msg = '\n'.join(kw.get('messages', []))
test_robot_counterpart = robot_suite.tests.create(name, tags=tags)
if kw['pass']:
args = [msg if msg else 'Test passed :D']
Expand Down

0 comments on commit 2da31da

Please sign in to comment.