Skip to content

Commit

Permalink
Emit aggregated statistics too.
Browse files Browse the repository at this point in the history
  • Loading branch information
Paebbels committed Apr 25, 2024
1 parent 4549770 commit 96aae5e
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 22 deletions.
4 changes: 2 additions & 2 deletions dist/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
wheel >= 0.40.0
twine >= 4.0.2
wheel ~= 0.43
twine ~= 5.0
6 changes: 3 additions & 3 deletions doc/Dependency.rst
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ install the mandatory dependencies too.
+============================================================================+==============+==========================================================================================================+======================================================================================================================================================+
| `pyTooling <https://GitHub.com/pyTooling/pyTooling>`__ | ≥6.1.0 | `Apache License, 2.0 <https://GitHub.com/pyTooling/pyTooling/blob/main/LICENSE.md>`__ | *None* |
+----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
| `wheel <https://GitHub.com/pypa/wheel>`__ | ≥0.40.0 | `MIT <https://github.com/pypa/wheel/blob/main/LICENSE.txt>`__ | *Not yet evaluated.* |
| `wheel <https://GitHub.com/pypa/wheel>`__ | ≥0.43 | `MIT <https://github.com/pypa/wheel/blob/main/LICENSE.txt>`__ | *Not yet evaluated.* |
+----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+


Expand Down Expand Up @@ -164,7 +164,7 @@ install the mandatory dependencies too.
+----------------------------------------------------------+--------------+-------------------------------------------------------------------------------------------+----------------------+
| **Package** | **Version** | **License** | **Dependencies** |
+==========================================================+==============+===========================================================================================+======================+
| `wheel <https://GitHub.com/pypa/wheel>`__ | ≥0.40.0 | `MIT <https://github.com/pypa/wheel/blob/main/LICENSE.txt>`__ | *Not yet evaluated.* |
| `wheel <https://GitHub.com/pypa/wheel>`__ | ≥0.43 | `MIT <https://github.com/pypa/wheel/blob/main/LICENSE.txt>`__ | *Not yet evaluated.* |
+----------------------------------------------------------+--------------+-------------------------------------------------------------------------------------------+----------------------+
| `Twine <https://GitHub.com/pypa/twine/>`__ |4.0.2 | `Apache License, 2.0 <https://github.com/pypa/twine/blob/main/LICENSE>`__ | *Not yet evaluated.* |
| `Twine <https://GitHub.com/pypa/twine/>`__ |5.0 | `Apache License, 2.0 <https://github.com/pypa/twine/blob/main/LICENSE>`__ | *Not yet evaluated.* |
+----------------------------------------------------------+--------------+-------------------------------------------------------------------------------------------+----------------------+
12 changes: 12 additions & 0 deletions pyEDAA/Reports/Unittesting/JUnit.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,12 @@ def Generate(self, overwrite: bool = False) -> None:
rootElement.attrib["timestamp"] = f"{self._startTime.isoformat()}"
if self._totalDuration is not None:
rootElement.attrib["time"] = f"{self._totalDuration.total_seconds():.6f}"
rootElement.attrib["tests"] = str(self._tests)
rootElement.attrib["failures"] = str(self._failed)
rootElement.attrib["errors"] = str(self._errored)
rootElement.attrib["skipped"] = str(self._skipped)
# if self._assertionCount is not None:
# rootElement.attrib["assertions"] = f"{self._assertionCount}"

self._xmlDocument = ElementTree(rootElement)

Expand All @@ -279,6 +285,12 @@ def _GenerateTestsuite(self, testsuite: Testsuite, parentElement: _Element):
testsuiteElement.attrib["timestamp"] = f"{testsuite._startTime.isoformat()}"
if testsuite._totalDuration is not None:
testsuiteElement.attrib["time"] = f"{testsuite._totalDuration.total_seconds():.6f}"
testsuiteElement.attrib["tests"] = str(testsuite._tests)
testsuiteElement.attrib["failures"] = str(testsuite._failed)
testsuiteElement.attrib["errors"] = str(testsuite._errored)
testsuiteElement.attrib["skipped"] = str(testsuite._skipped)
# if testsuite._assertionCount is not None:
# testsuiteElement.attrib["assertions"] = f"{testsuite._assertionCount}"

for ts in testsuite._testsuites.values():
self._GenerateTestsuite(ts, testsuiteElement)
Expand Down
49 changes: 33 additions & 16 deletions pyEDAA/Reports/Unittesting/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,11 +445,14 @@ def __init__(
self._testsuites[testsuite._name] = testsuite

self._status = TestsuiteStatus.Unknown
self._excluded = 0
self._skipped = 0
self._errored = 0
self._failed = 0
self._passed = 0
self._tests = 0
self._inconsistent = 0
self._excluded = 0
self._skipped = 0
self._errored = 0
self._weak = 0
self._failed = 0
self._passed = 0

@readonly
def Status(self) -> TestsuiteStatus:
Expand Down Expand Up @@ -483,19 +486,12 @@ def PassedAssertionCount(self) -> int:
# return self._assertionCount - (self._warningCount + self._errorCount + self._fatalCount)

@readonly
def WarningCount(self) -> int:
raise NotImplementedError()
# return self._warningCount

@readonly
def ErrorCount(self) -> int:
raise NotImplementedError()
# return self._errorCount
def Tests(self) -> int:
return self._tests

@readonly
def FatalCount(self) -> int:
raise NotImplementedError()
# return self._fatalCount
def Inconsistent(self) -> int:
return self._inconsistent

@readonly
def Excluded(self) -> int:
Expand All @@ -509,6 +505,10 @@ def Skipped(self) -> int:
def Errored(self) -> int:
return self._errored

@readonly
def Weak(self) -> int:
return self._weak

@readonly
def Failed(self) -> int:
return self._failed
Expand All @@ -517,6 +517,21 @@ def Failed(self) -> int:
def Passed(self) -> int:
return self._passed

@readonly
def WarningCount(self) -> int:
raise NotImplementedError()
# return self._warningCount

@readonly
def ErrorCount(self) -> int:
raise NotImplementedError()
# return self._errorCount

@readonly
def FatalCount(self) -> int:
raise NotImplementedError()
# return self._fatalCount

def Aggregate(self) -> TestsuiteAggregateReturnType:
tests = 0
inconsistent = 0
Expand Down Expand Up @@ -694,6 +709,7 @@ def Aggregate(self, strict: bool = True) -> TestsuiteAggregateReturnType:
else:
raise UnittestException(f"Internal error for testcase '{testcase._name}', field '_status' is '{status}'.")

self._tests = tests
self._inconsistent = inconsistent
self._excluded = excluded
self._skipped = skipped
Expand Down Expand Up @@ -771,6 +787,7 @@ def __init__(
def Aggregate(self) -> TestsuiteAggregateReturnType:
tests, inconsistent, excluded, skipped, errored, weak, failed, passed, warningCount, errorCount, fatalCount = super().Aggregate()

self._tests = tests
self._inconsistent = inconsistent
self._excluded = excluded
self._skipped = skipped
Expand Down
2 changes: 1 addition & 1 deletion pyEDAA/Reports/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
__email__ = "[email protected]"
__copyright__ = "2021-2024, Electronic Design Automation Abstraction (EDA²)"
__license__ = "Apache License, Version 2.0"
__version__ = "0.5.0"
__version__ = "0.5.1"
__keywords__ = ["Reports", "Abstract Model", "Data Model", "Test Case", "Test Suite", "OSVVM", "YAML", "XML"]

from enum import Enum
Expand Down

0 comments on commit 96aae5e

Please sign in to comment.