Skip to content

Commit

Permalink
Bumped version to v0.10.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
Paebbels committed Jun 2, 2024
1 parent 287b01c commit 5aa699c
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 16 deletions.
4 changes: 2 additions & 2 deletions pyEDAA/Reports/Unittesting/OSVVM.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class OsvvmYamlDocument(TestsuiteSummary, Document):
_yamlDocument: Nullable[YAML]

def __init__(self, yamlReportFile: Path, parse: bool = False) -> None:
super().__init__("Unprocessed JUnit XML file")
super().__init__("Unprocessed OSVVM YAML file")
Document.__init__(self, yamlReportFile)

self._yamlDocument = None
Expand Down Expand Up @@ -120,7 +120,7 @@ def Write(self, path: Nullable[Path] = None, overwrite: bool = False) -> None:
def Parse(self) -> None:
if self._yamlDocument is None:
ex = UnittestException(f"OSVVM YAML file '{self._path}' needs to be read and analyzed by a YAML parser.")
ex.add_note(f"Call 'OsvvmYamlDocument.Read()' or create document using 'OsvvmYamlDocument(path, parse=True)'.")
ex.add_note(f"Call 'Document.Read()' or create document using 'Document(path, parse=True)'.")
raise ex

startConversion = perf_counter_ns()
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__ = "Paebbels@gmail.com"
__copyright__ = "2021-2024, Electronic Design Automation Abstraction (EDA²)"
__license__ = "Apache License, Version 2.0"
__version__ = "0.9.0"
__version__ = "0.10.0"
__keywords__ = ["Reports", "Abstract Model", "Data Model", "Unit Testing", "Testcase", "Testsuite", "OSVVM", "YAML", "XML"]

from enum import Enum
Expand Down
45 changes: 33 additions & 12 deletions tests/unit/Unittesting/Examples/OSVVM.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ def test_RunAllTests(self):
self.assertGreaterEqual(doc.TestsuiteCount, 14)
self.assertGreater(doc.TestcaseCount, 0)

print("=" * 40)
tree = doc.ToTree()
print(tree.Render(), end="")
print("=" * 40)

print()
print(f"JUnit file:")
print(f" Testsuites: {doc.TestsuiteCount}")
print(f" Testcases: {doc.TestcaseCount}")
Expand All @@ -80,30 +86,45 @@ def test_RunAllTests(self):

class YAMLGeneratedByOSVVM(TestCase):
def test_ReadOSVVMTestSummaryYAML(self) -> None:
print()

yamlPath = Path("tests/data/OSVVM/osvvm.Summary.yml")
doc = OsvvmYamlDocument(yamlPath, parse=True)

print("=" * 40)
tree = doc.ToTree()
print(tree.Render(), end="")
print("=" * 40)

print()
print(f"YAML file:")
print(f" Testsuites: {doc.TestsuiteCount}")
print(f" Testcases: {doc.TestcaseCount}")

print()
print(f"Statistics:")
print(f" Times: parsing by ruamel.yaml: {doc.AnalysisDuration.total_seconds():.3f}s convert: {doc.ModelConversionDuration.total_seconds():.3f}s")

osvvmTestSummary = OsvvmYamlDocument(yamlPath, parse=True)
print(osvvmTestSummary.ToTree().Render())

self.assertEqual(14, len(osvvmTestSummary.Testsuites))
self.assertIn("Axi4Lite", osvvmTestSummary)
self.assertIn("Axi4Full", osvvmTestSummary)
self.assertIn("AxiStream", osvvmTestSummary)
self.assertIn("Uart", osvvmTestSummary)
self.assertEqual(14, len(doc.Testsuites))
self.assertIn("Axi4Lite", doc)
self.assertIn("Axi4Full", doc)
self.assertIn("AxiStream", doc)
self.assertIn("Uart", doc)

axi4lite = osvvmTestSummary["Axi4Lite"]
axi4lite = doc["Axi4Lite"]
self.assertEqual(17, len(axi4lite.Testcases))

axi4 = osvvmTestSummary["Axi4Full"]
axi4 = doc["Axi4Full"]
self.assertEqual(68, len(axi4.Testcases))

axi4stream = osvvmTestSummary["AxiStream"]
axi4stream = doc["AxiStream"]
self.assertEqual(65, len(axi4stream.Testcases))

uart = osvvmTestSummary["Uart"]
uart = doc["Uart"]
self.assertEqual(8, len(uart.Testcases))

# for suite in osvvmTestSummary:
# for suite in doc:
# self.printTestsuite(suite)
#
# def printTestsuite(self, testsuite: Testsuite, indent: int = 0):
Expand Down
1 change: 0 additions & 1 deletion tests/unit/Unittesting/Examples/pyEDAAReports.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ def test_ctest(self):
print(f" Times: parsing by lxml: {doc.AnalysisDuration.total_seconds():.3f}s convert: {doc.ModelConversionDuration.total_seconds():.3f}s")



class JavaAntJUnit4(TestCase):
def test_JUnit4(self):
print()
Expand Down

0 comments on commit 5aa699c

Please sign in to comment.