Skip to content

Commit

Permalink
Split and move testsuites.
Browse files Browse the repository at this point in the history
  • Loading branch information
Paebbels committed Sep 25, 2024
1 parent 1118ba5 commit 1b384fd
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions pyEDAA/Reports/CLI/Unittesting.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def _processPyTest(self, testsuiteSummary: TestsuiteSummary, cleanups: str) -> N
else:
self.WriteError(f"Syntax error: '{cleanup}'")

def _processPyTest_RewiteDunderInit(self, testsuiteSummary: TestsuiteSummary):
def _processPyTest_RewiteDunderInit(self, testsuiteSummary: TestsuiteSummary) -> None:
self.WriteVerbose(f" Rewriting '__init__' in classnames to actual Python package names")

def processTestsuite(suite: Testsuite) -> None:
Expand All @@ -312,7 +312,7 @@ def processTestsuite(suite: Testsuite) -> None:

processTestsuite(testsuiteSummary)

def _processPyTest_ReduceDepth(self, testsuiteSummary: TestsuiteSummary, path: str):
def _processPyTest_ReduceDepth(self, testsuiteSummary: TestsuiteSummary, path: str) -> None:
self.WriteVerbose(f" Reducing path depth of testsuite '{path}'")
cleanups = []
suite = testsuiteSummary
Expand Down Expand Up @@ -352,10 +352,30 @@ def _processPyTest_ReduceDepth(self, testsuiteSummary: TestsuiteSummary, path: s
self.WriteDebug(f" skipping '{name}'")
break

def _processPyTest_SplitTestsuite(self, testsuiteSummary: TestsuiteSummary, path: str):
def _processPyTest_SplitTestsuite(self, testsuiteSummary: TestsuiteSummary, path: str) -> None:
self.WriteVerbose(f" Splitting testsuite '{path}'")
for testsuite in testsuiteSummary.Testsuites[path].Testsuites.values():
self.WriteDebug(f" Moving {testsuite.Name} to {testsuiteSummary.Name}")
if path not in testsuiteSummary._testsuites:
self.WriteError(f"Path '{path}' not found")
return

cleanups = []
parentTestsuite = testsuiteSummary
workingTestsuite = parentTestsuite._testsuites[path]
for testsuite in workingTestsuite._testsuites.values():
self.WriteDebug(f" Moving {testsuite.Name} to {parentTestsuite.Name}")

testsuiteName = testsuite._name
parentTestsuite._testsuites[testsuiteName] = testsuite
testsuite._parent = parentTestsuite

cleanups.append(testsuiteName)

for cleanup in cleanups:
del workingTestsuite._testsuites[cleanup]

if len(workingTestsuite._testsuites) == 0 and len(workingTestsuite._testcases) == 0:
self.WriteVerbose(f" Removing empty testsuite '{path}'")
del parentTestsuite._testsuites[path]

def _output(self, testsuiteSummary: TestsuiteSummary, task: str):
parts = task.split(":")
Expand Down

0 comments on commit 1b384fd

Please sign in to comment.