pUnit 1.2.4__tar.gz → 1.2.7__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.4/src/pUnit.egg-info → punit-1.2.7}/PKG-INFO +2 -3
- {punit-1.2.4 → punit-1.2.7}/pyproject.toml +5 -3
- {punit-1.2.4 → punit-1.2.7/src/pUnit.egg-info}/PKG-INFO +2 -3
- {punit-1.2.4 → punit-1.2.7}/src/pUnit.egg-info/SOURCES.txt +1 -0
- punit-1.2.7/src/pUnit.egg-info/requires.txt +4 -0
- {punit-1.2.4 → punit-1.2.7}/src/punit/__init__.py +1 -1
- {punit-1.2.4 → punit-1.2.7}/src/punit/__main__.py +3 -3
- {punit-1.2.4 → punit-1.2.7}/src/punit/cli.py +1 -1
- {punit-1.2.4 → punit-1.2.7}/src/punit/facts/Fact.py +2 -2
- {punit-1.2.4 → punit-1.2.7}/src/punit/facts/FactManager.py +1 -1
- punit-1.2.7/src/punit/py.typed +0 -0
- {punit-1.2.4 → punit-1.2.7}/src/punit/reports/JUnitReportGenerator.py +6 -6
- {punit-1.2.4 → punit-1.2.7}/src/punit/runner.py +3 -2
- {punit-1.2.4 → punit-1.2.7}/src/punit/theories/Theory.py +2 -2
- {punit-1.2.4 → punit-1.2.7}/src/punit/theories/TheoryManager.py +1 -1
- punit-1.2.4/src/pUnit.egg-info/requires.txt +0 -5
- {punit-1.2.4 → punit-1.2.7}/.scripts/punit +0 -0
- {punit-1.2.4 → punit-1.2.7}/LICENSE +0 -0
- {punit-1.2.4 → punit-1.2.7}/README.md +0 -0
- {punit-1.2.4 → punit-1.2.7}/setup.cfg +0 -0
- {punit-1.2.4 → punit-1.2.7}/src/pUnit.egg-info/dependency_links.txt +0 -0
- {punit-1.2.4 → punit-1.2.7}/src/pUnit.egg-info/top_level.txt +0 -0
- {punit-1.2.4 → punit-1.2.7}/src/punit/TestResult.py +0 -0
- {punit-1.2.4 → punit-1.2.7}/src/punit/assertions/__init__.py +0 -0
- {punit-1.2.4 → punit-1.2.7}/src/punit/assertions/collections.py +0 -0
- {punit-1.2.4 → punit-1.2.7}/src/punit/assertions/exceptions.py +0 -0
- {punit-1.2.4 → punit-1.2.7}/src/punit/assertions/strings.py +0 -0
- {punit-1.2.4 → punit-1.2.7}/src/punit/discovery/TestModuleDiscovery.py +0 -0
- {punit-1.2.4 → punit-1.2.7}/src/punit/discovery/__init__.py +0 -0
- {punit-1.2.4 → punit-1.2.7}/src/punit/facts/__init__.py +0 -0
- {punit-1.2.4 → punit-1.2.7}/src/punit/reports/HtmlReportGenerator.py +0 -0
- {punit-1.2.4 → punit-1.2.7}/src/punit/reports/__init__.py +0 -0
- {punit-1.2.4 → punit-1.2.7}/src/punit/theories/__init__.py +0 -0
- {punit-1.2.4 → punit-1.2.7}/src/punit/traits/Trait.py +0 -0
- {punit-1.2.4 → punit-1.2.7}/src/punit/traits/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pUnit
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.7
|
|
4
4
|
Summary: A modernized unit-test framework for Python.
|
|
5
5
|
Author-email: Shaun Wilson <mrshaunwilson@msn.com>
|
|
6
6
|
License: MIT License
|
|
@@ -39,8 +39,7 @@ Requires-Python: >=3.12
|
|
|
39
39
|
Description-Content-Type: text/markdown
|
|
40
40
|
License-File: LICENSE
|
|
41
41
|
Provides-Extra: dev
|
|
42
|
-
Requires-Dist:
|
|
43
|
-
Requires-Dist: setuptools; extra == "dev"
|
|
42
|
+
Requires-Dist: mypy; extra == "dev"
|
|
44
43
|
Requires-Dist: twine; extra == "dev"
|
|
45
44
|
Dynamic: license-file
|
|
46
45
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "pUnit"
|
|
3
|
-
version = "1.2.
|
|
3
|
+
version = "1.2.7"
|
|
4
4
|
description = "A modernized unit-test framework for Python."
|
|
5
5
|
keywords = ["test", "unittest", "unit-test", "xUnit", "nUnit", "pytest"]
|
|
6
6
|
authors = [
|
|
@@ -22,8 +22,7 @@ dependencies = [
|
|
|
22
22
|
|
|
23
23
|
[project.optional-dependencies]
|
|
24
24
|
dev = [
|
|
25
|
-
"
|
|
26
|
-
"setuptools",
|
|
25
|
+
"mypy",
|
|
27
26
|
"twine"
|
|
28
27
|
]
|
|
29
28
|
|
|
@@ -46,3 +45,6 @@ exclude = [
|
|
|
46
45
|
|
|
47
46
|
[tool.setuptools.data-files]
|
|
48
47
|
bin = [".scripts/punit"]
|
|
48
|
+
|
|
49
|
+
[tool.setuptools.package-data]
|
|
50
|
+
"punit" = ["py.typed"]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pUnit
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.7
|
|
4
4
|
Summary: A modernized unit-test framework for Python.
|
|
5
5
|
Author-email: Shaun Wilson <mrshaunwilson@msn.com>
|
|
6
6
|
License: MIT License
|
|
@@ -39,8 +39,7 @@ Requires-Python: >=3.12
|
|
|
39
39
|
Description-Content-Type: text/markdown
|
|
40
40
|
License-File: LICENSE
|
|
41
41
|
Provides-Extra: dev
|
|
42
|
-
Requires-Dist:
|
|
43
|
-
Requires-Dist: setuptools; extra == "dev"
|
|
42
|
+
Requires-Dist: mypy; extra == "dev"
|
|
44
43
|
Requires-Dist: twine; extra == "dev"
|
|
45
44
|
Dynamic: license-file
|
|
46
45
|
|
|
@@ -10,7 +10,7 @@ from .reports import HtmlReportGenerator, JUnitReportGenerator
|
|
|
10
10
|
from .runner import TestRunner
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
async def async_main():
|
|
13
|
+
async def async_main() -> None:
|
|
14
14
|
ts = time.time()
|
|
15
15
|
cli = CommandLineInterface.parse()
|
|
16
16
|
if cli.help:
|
|
@@ -36,13 +36,13 @@ async def async_main():
|
|
|
36
36
|
if not cli.quiet:
|
|
37
37
|
print(f'Total: {len(results)}, Failures: {failureCount}, Took: {totalTime:.3f}s')
|
|
38
38
|
if cli.reportFormat is not None:
|
|
39
|
-
report:str
|
|
39
|
+
report:str = ''
|
|
40
40
|
match cli.reportFormat:
|
|
41
41
|
case 'html':
|
|
42
42
|
report = HtmlReportGenerator().generate(results)
|
|
43
43
|
case 'junit':
|
|
44
44
|
report = JUnitReportGenerator().generate(results)
|
|
45
|
-
if report
|
|
45
|
+
if len(report) > 0:
|
|
46
46
|
if cli.outputFilename is None:
|
|
47
47
|
print(report)
|
|
48
48
|
else:
|
|
@@ -288,7 +288,7 @@ Options:
|
|
|
288
288
|
self.__excludePatterns.append('/__*__')
|
|
289
289
|
|
|
290
290
|
@staticmethod
|
|
291
|
-
def parse(argv:list[str] = sys.argv) -> CommandLineInterface:
|
|
291
|
+
def parse(argv:list[str] = sys.argv) -> 'CommandLineInterface':
|
|
292
292
|
result = CommandLineInterface().__parse(argv)
|
|
293
293
|
result.validate()
|
|
294
294
|
return result
|
|
@@ -12,7 +12,7 @@ class Fact:
|
|
|
12
12
|
|
|
13
13
|
__className:Optional[str]
|
|
14
14
|
__moduleName:str
|
|
15
|
-
__target:FunctionType|MethodType
|
|
15
|
+
__target:FunctionType|MethodType|Callable
|
|
16
16
|
__testName:Optional[str]
|
|
17
17
|
__traits:list[Trait]
|
|
18
18
|
|
|
@@ -32,7 +32,7 @@ class Fact:
|
|
|
32
32
|
return self.__moduleName
|
|
33
33
|
|
|
34
34
|
@property
|
|
35
|
-
def target(self) -> FunctionType|MethodType:
|
|
35
|
+
def target(self) -> FunctionType|MethodType|Callable:
|
|
36
36
|
return self.__target
|
|
37
37
|
|
|
38
38
|
@property
|
|
File without changes
|
|
@@ -54,7 +54,6 @@ class JUnitTestSuite:
|
|
|
54
54
|
name:Optional[str] = None
|
|
55
55
|
hostname:Optional[str] = None
|
|
56
56
|
id:Optional[int] = None
|
|
57
|
-
name:Optional[str] = None
|
|
58
57
|
package:Optional[str] = None
|
|
59
58
|
timestamp:Optional[datetime.datetime] = None
|
|
60
59
|
# eles
|
|
@@ -97,7 +96,7 @@ class JUnitTestSuite:
|
|
|
97
96
|
return result
|
|
98
97
|
|
|
99
98
|
@property
|
|
100
|
-
def tests(self) ->
|
|
99
|
+
def tests(self) -> int:
|
|
101
100
|
return 0 if self.testCases is None else len(self.testCases)
|
|
102
101
|
|
|
103
102
|
@property
|
|
@@ -117,11 +116,12 @@ class JUnitReportGenerator:
|
|
|
117
116
|
def generate(self, testResults:list[TestResult]) -> str:
|
|
118
117
|
# transform to intermediary model
|
|
119
118
|
testSuites:dict[str, JUnitTestSuite] = {}
|
|
120
|
-
|
|
119
|
+
testSuite:JUnitTestSuite|None
|
|
120
|
+
ts:float = 0
|
|
121
121
|
for testResult in testResults:
|
|
122
122
|
if testResult.stopTime is not None and ts < testResult.stopTime:
|
|
123
123
|
ts = testResult.stopTime
|
|
124
|
-
testSuite
|
|
124
|
+
testSuite = testSuites.get(testResult.moduleName)
|
|
125
125
|
if testSuite is None:
|
|
126
126
|
testSuite = JUnitTestSuite()
|
|
127
127
|
testSuite.name = testResult.moduleName
|
|
@@ -139,10 +139,10 @@ class JUnitReportGenerator:
|
|
|
139
139
|
totalErrorCount = 0
|
|
140
140
|
totalFailureCount = 0
|
|
141
141
|
totalTestCount = 0
|
|
142
|
-
totalTime = 0
|
|
142
|
+
totalTime:float = 0
|
|
143
143
|
testSuitesEle:et.Element = et.Element('testsuites')
|
|
144
144
|
for testSuiteName in testSuites:
|
|
145
|
-
testSuite
|
|
145
|
+
testSuite = testSuites[testSuiteName]
|
|
146
146
|
if testSuite is not None:
|
|
147
147
|
totalTime += testSuite.time
|
|
148
148
|
totalDisabledCount += testSuite.disabled
|
|
@@ -40,6 +40,7 @@ class TestRunner:
|
|
|
40
40
|
|
|
41
41
|
async def run(self) -> list[TestResult]:
|
|
42
42
|
results:list[TestResult] = []
|
|
43
|
+
result:TestResult
|
|
43
44
|
# TODO: aliasing
|
|
44
45
|
hostName:str = socket.gethostname()
|
|
45
46
|
testPackagePath = os.path.join(os.path.abspath(os.curdir), self.__testPackageName).replace('\\', '/')
|
|
@@ -52,7 +53,7 @@ class TestRunner:
|
|
|
52
53
|
# execute all facts
|
|
53
54
|
facts = FactManager.instance().get(testModule.__name__)
|
|
54
55
|
for fact in facts:
|
|
55
|
-
result
|
|
56
|
+
result = TestResult()
|
|
56
57
|
result.hostName = hostName
|
|
57
58
|
result.packageName = self.__testPackageName
|
|
58
59
|
result.fileName = filename
|
|
@@ -77,7 +78,7 @@ class TestRunner:
|
|
|
77
78
|
theories = TheoryManager.instance().get(testModule.__name__)
|
|
78
79
|
for theory in theories:
|
|
79
80
|
for data in theory.datas:
|
|
80
|
-
result
|
|
81
|
+
result = TestResult()
|
|
81
82
|
result.hostName = hostName
|
|
82
83
|
result.packageName = self.__testPackageName
|
|
83
84
|
result.properties['data'] = data
|
|
@@ -14,7 +14,7 @@ class Theory:
|
|
|
14
14
|
__className:Optional[str]
|
|
15
15
|
__datas:list[tuple]
|
|
16
16
|
__moduleName:str
|
|
17
|
-
__target:FunctionType|MethodType
|
|
17
|
+
__target:FunctionType|MethodType|Callable
|
|
18
18
|
__testName:Optional[str]
|
|
19
19
|
__traits:list[Trait]
|
|
20
20
|
|
|
@@ -39,7 +39,7 @@ class Theory:
|
|
|
39
39
|
return self.__moduleName
|
|
40
40
|
|
|
41
41
|
@property
|
|
42
|
-
def target(self) -> FunctionType|MethodType:
|
|
42
|
+
def target(self) -> FunctionType|MethodType|Callable:
|
|
43
43
|
return self.__target
|
|
44
44
|
|
|
45
45
|
@property
|
|
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
|