Skip to content

Commit

Permalink
Fixed missing pytest post-processing tasks.
Browse files Browse the repository at this point in the history
  • Loading branch information
Paebbels committed Jun 3, 2024
1 parent af77d9f commit 42ae24a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/Pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ jobs:
- UnitTestingParams
- UnitTesting
with:
additional_merge_args: '--pytest "pytest.tests.unit"'
additional_merge_args: '"--pytest=reduce-depth:pytest.tests.unit"'
merged_junit_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).unittesting_xml }}

IntermediateCleanUp:
Expand Down
33 changes: 26 additions & 7 deletions pyEDAA/Reports/CLI/Unittesting.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
from pyTooling.Attributes.ArgParse import CommandHandler
from pyTooling.Attributes.ArgParse.ValuedFlag import LongValuedFlag

from pyEDAA.Reports.Unittesting import TestsuiteKind, TestsuiteSummary, MergedTestsuiteSummary, UnittestException
from pyEDAA.Reports.Unittesting import UnittestException, TestsuiteKind, TestsuiteSummary, Testsuite, Testcase
from pyEDAA.Reports.Unittesting import MergedTestsuiteSummary
from pyEDAA.Reports.Unittesting.JUnit import JUnitReaderMode


Expand Down Expand Up @@ -45,11 +46,6 @@ def HandleUnittest(self, args: Namespace) -> None:
if args.pytest is not None:
self._processPyTest(result, args.pytest)

if args.output is not None:
outputs = (args.output, )
for output in outputs:
self._output(result, output)

if args.render is not None and self.Verbose:
self.WriteVerbose("*" * self.Width)

Expand All @@ -59,6 +55,11 @@ def HandleUnittest(self, args: Namespace) -> None:

self.WriteVerbose("*" * self.Width)

if args.output is not None:
outputs = (args.output, )
for output in outputs:
self._output(result, output)

self.ExitOnPreviousErrors()

def _merge(self, testsuiteSummary: MergedTestsuiteSummary, task: str) -> None:
Expand Down Expand Up @@ -174,7 +175,25 @@ def _processPyTest(self, testsuiteSummary: TestsuiteSummary, cleanups: str) -> N

def _processPyTest_RewiteDunderInit(self, testsuiteSummary: TestsuiteSummary):
self.WriteVerbose(f" Rewriting '__init__' in classnames to actual Python package names")
self.WriteError("Rewrite __init__ not yet supported!")

def processTestsuite(suite: Testsuite) -> None:
testsuites: Tuple[Testsuite, ...] = tuple(ts for ts in suite.Testsuites.values())
for testsuite in testsuites: # type: Testsuite
if testsuite.Name != "__init__":
processTestsuite(testsuite)
continue

for ts in testsuite.Testsuites.values(): # type: Testsuite
ts._parent = None
suite.AddTestsuite(ts)

for tc in testsuite.Testcases.values(): # type: Testcase
tc._parent = None
suite.AddTestcase(tc)

del suite._testsuites["__init__"]

processTestsuite(testsuiteSummary)

def _processPyTest_ReduceDepth(self, testsuiteSummary: TestsuiteSummary, path: str):
self.WriteVerbose(f" Reducing path depth of testsuite '{path}'")
Expand Down

0 comments on commit 42ae24a

Please sign in to comment.