pUnit 1.2.26__tar.gz → 1.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {punit-1.2.26/src/pUnit.egg-info → punit-1.3.0}/PKG-INFO +1 -1
- {punit-1.2.26 → punit-1.3.0}/pyproject.toml +1 -1
- {punit-1.2.26 → punit-1.3.0/src/pUnit.egg-info}/PKG-INFO +1 -1
- {punit-1.2.26 → punit-1.3.0}/src/pUnit.egg-info/SOURCES.txt +1 -0
- {punit-1.2.26 → punit-1.3.0}/src/punit/__init__.py +2 -2
- {punit-1.2.26 → punit-1.3.0}/src/punit/__main__.py +3 -1
- {punit-1.2.26 → punit-1.3.0}/src/punit/cli.py +1 -1
- punit-1.3.0/src/punit/reports/JsonReportGenerator.py +30 -0
- {punit-1.2.26 → punit-1.3.0}/src/punit/reports/__init__.py +8 -0
- {punit-1.2.26 → punit-1.3.0}/.scripts/punit +0 -0
- {punit-1.2.26 → punit-1.3.0}/LICENSE +0 -0
- {punit-1.2.26 → punit-1.3.0}/README.md +0 -0
- {punit-1.2.26 → punit-1.3.0}/setup.cfg +0 -0
- {punit-1.2.26 → punit-1.3.0}/src/pUnit.egg-info/dependency_links.txt +0 -0
- {punit-1.2.26 → punit-1.3.0}/src/pUnit.egg-info/requires.txt +0 -0
- {punit-1.2.26 → punit-1.3.0}/src/pUnit.egg-info/top_level.txt +0 -0
- {punit-1.2.26 → punit-1.3.0}/src/punit/TestResult.py +0 -0
- {punit-1.2.26 → punit-1.3.0}/src/punit/assertions/__init__.py +0 -0
- {punit-1.2.26 → punit-1.3.0}/src/punit/assertions/collections.py +0 -0
- {punit-1.2.26 → punit-1.3.0}/src/punit/assertions/exceptions.py +0 -0
- {punit-1.2.26 → punit-1.3.0}/src/punit/assertions/strings.py +0 -0
- {punit-1.2.26 → punit-1.3.0}/src/punit/discovery/TestModuleDiscovery.py +0 -0
- {punit-1.2.26 → punit-1.3.0}/src/punit/discovery/__init__.py +0 -0
- {punit-1.2.26 → punit-1.3.0}/src/punit/facts/Fact.py +0 -0
- {punit-1.2.26 → punit-1.3.0}/src/punit/facts/FactManager.py +0 -0
- {punit-1.2.26 → punit-1.3.0}/src/punit/facts/__init__.py +0 -0
- {punit-1.2.26 → punit-1.3.0}/src/punit/filters/Filter.py +0 -0
- {punit-1.2.26 → punit-1.3.0}/src/punit/filters/FilterManager.py +0 -0
- {punit-1.2.26 → punit-1.3.0}/src/punit/filters/__init__.py +0 -0
- {punit-1.2.26 → punit-1.3.0}/src/punit/metadata/CallableMetadata.py +0 -0
- {punit-1.2.26 → punit-1.3.0}/src/punit/metadata/__init__.py +0 -0
- {punit-1.2.26 → punit-1.3.0}/src/punit/py.typed +0 -0
- {punit-1.2.26 → punit-1.3.0}/src/punit/reports/HtmlReportGenerator.py +0 -0
- {punit-1.2.26 → punit-1.3.0}/src/punit/reports/JUnitReportGenerator.py +0 -0
- {punit-1.2.26 → punit-1.3.0}/src/punit/runner.py +0 -0
- {punit-1.2.26 → punit-1.3.0}/src/punit/theories/Theory.py +0 -0
- {punit-1.2.26 → punit-1.3.0}/src/punit/theories/TheoryManager.py +0 -0
- {punit-1.2.26 → punit-1.3.0}/src/punit/theories/__init__.py +0 -0
- {punit-1.2.26 → punit-1.3.0}/src/punit/traits/Trait.py +0 -0
- {punit-1.2.26 → punit-1.3.0}/src/punit/traits/TraitManager.py +0 -0
- {punit-1.2.26 → punit-1.3.0}/src/punit/traits/__init__.py +0 -0
|
@@ -29,6 +29,7 @@ src/punit/metadata/CallableMetadata.py
|
|
|
29
29
|
src/punit/metadata/__init__.py
|
|
30
30
|
src/punit/reports/HtmlReportGenerator.py
|
|
31
31
|
src/punit/reports/JUnitReportGenerator.py
|
|
32
|
+
src/punit/reports/JsonReportGenerator.py
|
|
32
33
|
src/punit/reports/__init__.py
|
|
33
34
|
src/punit/theories/Theory.py
|
|
34
35
|
src/punit/theories/TheoryManager.py
|
|
@@ -6,7 +6,7 @@ import os
|
|
|
6
6
|
import time
|
|
7
7
|
from .cli import CommandLineInterface
|
|
8
8
|
from .discovery import TestModuleDiscovery
|
|
9
|
-
from .reports import HtmlReportGenerator, JUnitReportGenerator
|
|
9
|
+
from .reports import HtmlReportGenerator, JUnitReportGenerator, JsonReportGenerator
|
|
10
10
|
from .runner import TestRunner
|
|
11
11
|
|
|
12
12
|
|
|
@@ -42,6 +42,8 @@ async def async_main() -> None:
|
|
|
42
42
|
report = HtmlReportGenerator().generate(results)
|
|
43
43
|
case 'junit':
|
|
44
44
|
report = JUnitReportGenerator().generate(results)
|
|
45
|
+
case 'json':
|
|
46
|
+
report = JsonReportGenerator().generate(results)
|
|
45
47
|
if len(report) > 0:
|
|
46
48
|
if cli.outputFilename is None:
|
|
47
49
|
print(report)
|
|
@@ -95,7 +95,7 @@ class CommandLineInterface:
|
|
|
95
95
|
extractReportFormat = False
|
|
96
96
|
self.__reportFormat = arg.lower()
|
|
97
97
|
match self.__reportFormat:
|
|
98
|
-
case 'html' | 'junit':
|
|
98
|
+
case 'html' | 'junit' | 'json':
|
|
99
99
|
pass
|
|
100
100
|
case _:
|
|
101
101
|
print(f'Unsupported value "{arg}" for --report argument, aborting.')
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: © 2026 Shaun Wilson
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
import json
|
|
5
|
+
import traceback
|
|
6
|
+
from typing import Any
|
|
7
|
+
|
|
8
|
+
from ..TestResult import TestResult
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class JsonReportGenerator:
|
|
13
|
+
|
|
14
|
+
def generate(self, testResults:list[TestResult]) -> str:
|
|
15
|
+
testResults.sort(key=lambda e : e.moduleName)
|
|
16
|
+
results = list[dict[str, Any]]()
|
|
17
|
+
for testResult in testResults:
|
|
18
|
+
result = dict[str, Any]({
|
|
19
|
+
'status': 'pass' if testResult.isSuccess else 'fail',
|
|
20
|
+
'name': testResult.testName,
|
|
21
|
+
})
|
|
22
|
+
if testResult.took is not None:
|
|
23
|
+
result['took'] = round(testResult.took * 1000, 3)
|
|
24
|
+
if not testResult.isSuccess:
|
|
25
|
+
if testResult.exception is not None:
|
|
26
|
+
result['message'] = f'{testResult.exception}\n{"".join(traceback.format_tb(testResult.exception.__traceback__))}'
|
|
27
|
+
else:
|
|
28
|
+
result['message'] = 'Unknown Error'
|
|
29
|
+
results.append(result)
|
|
30
|
+
return json.dumps(results)
|
|
@@ -3,3 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
from .HtmlReportGenerator import HtmlReportGenerator
|
|
5
5
|
from .JUnitReportGenerator import JUnitReportGenerator
|
|
6
|
+
from .JsonReportGenerator import JsonReportGenerator
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
__all__ = [
|
|
10
|
+
'HtmlReportGenerator',
|
|
11
|
+
'JUnitReportGenerator',
|
|
12
|
+
'JsonReportGenerator'
|
|
13
|
+
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|