diff --git a/CHANGELOG.md b/CHANGELOG.md index 4493296..b2f5c7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [4.0.1] - 2024-08-09 + +- #45: Fixed Python line 0 tracking for 2024.2 + ## [4.0.0] - 2024-08-01 ### Changed diff --git a/cls/TestCoverage/Data/CodeUnit.cls b/cls/TestCoverage/Data/CodeUnit.cls index 0ac96c3..09781d7 100644 --- a/cls/TestCoverage/Data/CodeUnit.cls +++ b/cls/TestCoverage/Data/CodeUnit.cls @@ -82,9 +82,9 @@ ClassMethod GetCurrentByName(pInternalName As %String, pSourceNamespace As %Stri $$$ThrowOnError(tSC) Set tKnownHash = tMapToResult.%GetData(1) Set tMapToUnit = ..HashOpen(tKnownHash,,.tSC) - $$$ThrowOnError(tSC) - $$$ThrowOnError(..GetCurrentByName(tMapToUnit.Name_"."_tMapToUnit.Type,pSourceNamespace,.tUpdatedUnit,.pCache)) - If (tUpdatedUnit.Hash '= tKnownHash) { + $$$ThrowOnError(tSC) + do ..GetCurrentHash(tMapToUnit.Name, tMapToUnit.Type, .tUpdatedHash, , ) + If (tUpdatedHash '= tKnownHash) { //Clear out old data and flag the need for an update. Set tNeedsUpdate = 1 &sql(delete from TestCoverage_Data.CodeUnitMap where ToHash = :tKnownHash) @@ -247,7 +247,6 @@ ClassMethod GetCurrentByName(pInternalName As %String, pSourceNamespace As %Stri /// Fill in the LineIsPython property of .cls files Method UpdatePythonLines(pName As %String, ByRef pPyCodeUnit) As %Status { - Set tSC = $$$OK Set tOriginalNamespace = $Namespace Set tInitTLevel = $TLevel @@ -543,8 +542,9 @@ Method UpdateComplexity() As %Status // python methods If (##class(TestCoverage.Manager).HasPython(..Name)) { - do ##class(TestCoverage.Data.CodeUnit).GetCurrentByName(..Name _ ".PY", , .pPyCodeUnit, ) // need the source code for the python - set tDocumentText = pPyCodeUnit.Lines.Serialize() + do ..GetCurrentHash(..Name, "PY", ,.tPyCodeArray, ) // need the source code for the python to pass into the method complexity calculator + do ##class(TestCoverage.Utils).CodeArrayToList(.tPyCodeArray, .tDocumentText) + set tDocumentText = tDocumentText _ $listbuild("") set tMethodComplexities = ..GetPythonComplexities(tDocumentText) } diff --git a/cls/TestCoverage/Utils/LineByLineMonitor.cls b/cls/TestCoverage/Utils/LineByLineMonitor.cls index fe929d9..858ad7e 100644 --- a/cls/TestCoverage/Utils/LineByLineMonitor.cls +++ b/cls/TestCoverage/Utils/LineByLineMonitor.cls @@ -68,7 +68,7 @@ ClassMethod PyStartWithScope(pCoverageClasses As %List) [ Language = python ] class_name = frame.f_globals['__name__'] # extracts the line number line_no = frame.f_lineno - if class_name in tCoverageClasses and line_no != 1: # if this is in a covered class + if class_name in tCoverageClasses and line_no > 1: # if this is in a covered class tGlob = iris.gref('^IRIS.Temp.TestCoveragePY') # python doesn't have macros -- this is $$$PyMonitorResults # $$$PyMonitorResults(classname, linenumber) = the number of times that linenumber in that class was covered diff --git a/module.xml b/module.xml index 0d230e1..5540c9e 100644 --- a/module.xml +++ b/module.xml @@ -2,7 +2,7 @@ TestCoverage - 4.0.0 + 4.0.1 Run your typical ObjectScript %UnitTest tests and see which lines of your code are executed. Includes Cobertura-style reporting for use in continuous integration tools. module