Skip to content

Commit

Permalink
Merge pull request #45 from intersystems/2024.2-Python
Browse files Browse the repository at this point in the history
2024.2 python bug fix
  • Loading branch information
isc-tleavitt authored Aug 14, 2024
2 parents e8afd4e + f8fd42e commit 77981bc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions cls/TestCoverage/Data/CodeUnit.cls
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion cls/TestCoverage/Utils/LineByLineMonitor.cls
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Export generator="Cache" version="25">
<Document name="TestCoverage.ZPM"><Module>
<Name>TestCoverage</Name>
<Version>4.0.0</Version>
<Version>4.0.1</Version>
<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>
<Packaging>module</Packaging>
<Resource Name="TestCoverage.PKG" Directory="cls" />
Expand Down

0 comments on commit 77981bc

Please sign in to comment.