Skip to content

Commit 77981bc

Browse files
authored
Merge pull request #45 from intersystems/2024.2-Python
2024.2 python bug fix
2 parents e8afd4e + f8fd42e commit 77981bc

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [4.0.1] - 2024-08-09
9+
10+
- #45: Fixed Python line 0 tracking for 2024.2
11+
812
## [4.0.0] - 2024-08-01
913

1014
### Changed

cls/TestCoverage/Data/CodeUnit.cls

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ ClassMethod GetCurrentByName(pInternalName As %String, pSourceNamespace As %Stri
8282
$$$ThrowOnError(tSC)
8383
Set tKnownHash = tMapToResult.%GetData(1)
8484
Set tMapToUnit = ..HashOpen(tKnownHash,,.tSC)
85-
$$$ThrowOnError(tSC)
86-
$$$ThrowOnError(..GetCurrentByName(tMapToUnit.Name_"."_tMapToUnit.Type,pSourceNamespace,.tUpdatedUnit,.pCache))
87-
If (tUpdatedUnit.Hash '= tKnownHash) {
85+
$$$ThrowOnError(tSC)
86+
do ..GetCurrentHash(tMapToUnit.Name, tMapToUnit.Type, .tUpdatedHash, , )
87+
If (tUpdatedHash '= tKnownHash) {
8888
//Clear out old data and flag the need for an update.
8989
Set tNeedsUpdate = 1
9090
&sql(delete from TestCoverage_Data.CodeUnitMap where ToHash = :tKnownHash)
@@ -247,7 +247,6 @@ ClassMethod GetCurrentByName(pInternalName As %String, pSourceNamespace As %Stri
247247
/// Fill in the LineIsPython property of .cls files
248248
Method UpdatePythonLines(pName As %String, ByRef pPyCodeUnit) As %Status
249249
{
250-
251250
Set tSC = $$$OK
252251
Set tOriginalNamespace = $Namespace
253252
Set tInitTLevel = $TLevel
@@ -543,8 +542,9 @@ Method UpdateComplexity() As %Status
543542

544543
// python methods
545544
If (##class(TestCoverage.Manager).HasPython(..Name)) {
546-
do ##class(TestCoverage.Data.CodeUnit).GetCurrentByName(..Name _ ".PY", , .pPyCodeUnit, ) // need the source code for the python
547-
set tDocumentText = pPyCodeUnit.Lines.Serialize()
545+
do ..GetCurrentHash(..Name, "PY", ,.tPyCodeArray, ) // need the source code for the python to pass into the method complexity calculator
546+
do ##class(TestCoverage.Utils).CodeArrayToList(.tPyCodeArray, .tDocumentText)
547+
set tDocumentText = tDocumentText _ $listbuild("")
548548
set tMethodComplexities = ..GetPythonComplexities(tDocumentText)
549549
}
550550

cls/TestCoverage/Utils/LineByLineMonitor.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ ClassMethod PyStartWithScope(pCoverageClasses As %List) [ Language = python ]
6868
class_name = frame.f_globals['__name__']
6969
# extracts the line number
7070
line_no = frame.f_lineno
71-
if class_name in tCoverageClasses and line_no != 1: # if this is in a covered class
71+
if class_name in tCoverageClasses and line_no > 1: # if this is in a covered class
7272
tGlob = iris.gref('^IRIS.Temp.TestCoveragePY') # python doesn't have macros -- this is $$$PyMonitorResults
7373
# $$$PyMonitorResults(classname, linenumber) = the number of times that linenumber in that class was covered
7474

module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Export generator="Cache" version="25">
33
<Document name="TestCoverage.ZPM"><Module>
44
<Name>TestCoverage</Name>
5-
<Version>4.0.0</Version>
5+
<Version>4.0.1</Version>
66
<Description>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.</Description>
77
<Packaging>module</Packaging>
88
<Resource Name="TestCoverage.PKG" Directory="cls" />

0 commit comments

Comments
 (0)