Skip to content

Commit e36cc17

Browse files
author
Matej Cotman
committed
feat(oxygen): replace try-except block with underlying method
1 parent 668d5c5 commit e36cc17

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/oxygen/oxygen.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,12 @@ def __init__(self):
8585
self.run_time_data = {}
8686

8787
def end_test(self, name, attributes):
88-
try:
89-
lib = BuiltIn().get_library_instance('oxygen.OxygenLibrary')
90-
if lib:
91-
self.run_time_data[attributes['longname']] = lib.data
92-
except RuntimeError as error:
93-
if str(error) != "No library 'oxygen.OxygenLibrary' found.":
94-
raise error
88+
libs = [*BuiltIn()._get_context().namespace.libraries]
89+
if 'oxygen.OxygenLibrary' not in [lib.name for lib in libs]:
90+
return
91+
lib_instance = BuiltIn().get_library_instance('oxygen.OxygenLibrary')
92+
if lib_instance:
93+
self.run_time_data[attributes['longname']] = lib_instance.data
9594

9695
def output_file(self, path):
9796
result = ExecutionResult(path)

0 commit comments

Comments
 (0)