Skip to content

Commit a5389eb

Browse files
committed
fix: some code is executed from apparently unnamed classes
1 parent c95eafd commit a5389eb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cls/TestCoverage/Utils/LineByLineMonitor.cls

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ ClassMethod PyStartWithScope(pCoverageClasses As %List) [ Language = python ]
7676
# extracts frame code
7777
code = frame.f_code
7878
# extracts calling function name and the class that the function is in
79-
class_name = frame.f_globals['__name__']
79+
class_name = frame.f_globals.get('__name__', None) # Use get to avoid KeyError
8080
# extracts the line number
8181
line_no = frame.f_lineno
82-
if class_name in tCoverageClasses and line_no > 1: # if this is in a covered class
82+
if class_name and class_name in tCoverageClasses and line_no > 1: # if this is in a covered class
8383
tGlob = iris.gref('^IRIS.Temp.TestCoveragePY') # python doesn't have macros -- this is $$$PyMonitorResults
8484
# $$$PyMonitorResults(classname, linenumber) = the number of times that linenumber in that class was covered
8585

0 commit comments

Comments
 (0)