pUnit 1.2.3__tar.gz → 1.2.6__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.
Files changed (34) hide show
  1. {punit-1.2.3/src/pUnit.egg-info → punit-1.2.6}/PKG-INFO +2 -3
  2. {punit-1.2.3 → punit-1.2.6}/pyproject.toml +2 -3
  3. {punit-1.2.3 → punit-1.2.6/src/pUnit.egg-info}/PKG-INFO +2 -3
  4. punit-1.2.6/src/pUnit.egg-info/requires.txt +4 -0
  5. {punit-1.2.3 → punit-1.2.6}/src/punit/__init__.py +1 -1
  6. {punit-1.2.3 → punit-1.2.6}/src/punit/__main__.py +3 -3
  7. {punit-1.2.3 → punit-1.2.6}/src/punit/cli.py +1 -1
  8. {punit-1.2.3 → punit-1.2.6}/src/punit/facts/Fact.py +2 -2
  9. {punit-1.2.3 → punit-1.2.6}/src/punit/facts/FactManager.py +2 -2
  10. {punit-1.2.3 → punit-1.2.6}/src/punit/reports/JUnitReportGenerator.py +6 -6
  11. {punit-1.2.3 → punit-1.2.6}/src/punit/runner.py +3 -2
  12. {punit-1.2.3 → punit-1.2.6}/src/punit/theories/Theory.py +2 -2
  13. {punit-1.2.3 → punit-1.2.6}/src/punit/theories/TheoryManager.py +2 -2
  14. punit-1.2.3/src/pUnit.egg-info/requires.txt +0 -5
  15. {punit-1.2.3 → punit-1.2.6}/.scripts/punit +0 -0
  16. {punit-1.2.3 → punit-1.2.6}/LICENSE +0 -0
  17. {punit-1.2.3 → punit-1.2.6}/README.md +0 -0
  18. {punit-1.2.3 → punit-1.2.6}/setup.cfg +0 -0
  19. {punit-1.2.3 → punit-1.2.6}/src/pUnit.egg-info/SOURCES.txt +0 -0
  20. {punit-1.2.3 → punit-1.2.6}/src/pUnit.egg-info/dependency_links.txt +0 -0
  21. {punit-1.2.3 → punit-1.2.6}/src/pUnit.egg-info/top_level.txt +0 -0
  22. {punit-1.2.3 → punit-1.2.6}/src/punit/TestResult.py +0 -0
  23. {punit-1.2.3 → punit-1.2.6}/src/punit/assertions/__init__.py +0 -0
  24. {punit-1.2.3 → punit-1.2.6}/src/punit/assertions/collections.py +0 -0
  25. {punit-1.2.3 → punit-1.2.6}/src/punit/assertions/exceptions.py +0 -0
  26. {punit-1.2.3 → punit-1.2.6}/src/punit/assertions/strings.py +0 -0
  27. {punit-1.2.3 → punit-1.2.6}/src/punit/discovery/TestModuleDiscovery.py +0 -0
  28. {punit-1.2.3 → punit-1.2.6}/src/punit/discovery/__init__.py +0 -0
  29. {punit-1.2.3 → punit-1.2.6}/src/punit/facts/__init__.py +0 -0
  30. {punit-1.2.3 → punit-1.2.6}/src/punit/reports/HtmlReportGenerator.py +0 -0
  31. {punit-1.2.3 → punit-1.2.6}/src/punit/reports/__init__.py +0 -0
  32. {punit-1.2.3 → punit-1.2.6}/src/punit/theories/__init__.py +0 -0
  33. {punit-1.2.3 → punit-1.2.6}/src/punit/traits/Trait.py +0 -0
  34. {punit-1.2.3 → punit-1.2.6}/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
3
+ Version: 1.2.6
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: build; extra == "dev"
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"
3
+ version = "1.2.6"
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
- "build",
26
- "setuptools",
25
+ "mypy",
27
26
  "twine"
28
27
  ]
29
28
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pUnit
3
- Version: 1.2.3
3
+ Version: 1.2.6
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: build; extra == "dev"
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
 
@@ -0,0 +1,4 @@
1
+
2
+ [dev]
3
+ mypy
4
+ twine
@@ -1,7 +1,7 @@
1
1
  # SPDX-FileCopyrightText: © 2024 Shaun Wilson
2
2
  # SPDX-License-Identifier: MIT
3
3
 
4
- __version__ = '1.2.3'
4
+ __version__ = '1.2.6'
5
5
 
6
6
  from .assertions import *
7
7
  from .facts import *
@@ -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|None = None
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 is not None:
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
@@ -13,7 +13,7 @@ class FactManager:
13
13
 
14
14
  __excludeTraits:list[Trait]
15
15
  __filterPattern:Optional[re.Pattern]
16
- __instance:'FactManager'|None = None
16
+ __instance:Optional['FactManager'] = None
17
17
  __includeTraits:list[Trait]
18
18
  __modules:dict[str, list[Fact]]
19
19
  __traits:dict[Callable, list[Trait]]
@@ -26,7 +26,7 @@ class FactManager:
26
26
  self.__traits = {}
27
27
 
28
28
  @staticmethod
29
- def instance() -> FactManager:
29
+ def instance() -> 'FactManager':
30
30
  if FactManager.__instance is None:
31
31
  FactManager.__instance = FactManager()
32
32
  return FactManager.__instance
@@ -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) -> float:
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
- ts = 0
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:JUnitTestSuite|None = testSuites.get(testResult.moduleName)
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:JUnitTestSuite|None = testSuites[testSuiteName]
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:TestResult = TestResult()
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:TestResult = TestResult()
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
@@ -14,7 +14,7 @@ class TheoryManager:
14
14
  __excludeTraits:list[Trait]
15
15
  __filterPattern:Optional[re.Pattern]
16
16
  __includeTraits:list[Trait]
17
- __instance:'TheoryManager'|None = None
17
+ __instance:Optional['TheoryManager'] = None
18
18
  __modules:dict[str, list[Theory]]
19
19
  __datas:dict[Callable, list[tuple]]
20
20
  __traits:dict[Callable, list[Trait]]
@@ -28,7 +28,7 @@ class TheoryManager:
28
28
  self.__traits = {}
29
29
 
30
30
  @staticmethod
31
- def instance() -> TheoryManager:
31
+ def instance() -> 'TheoryManager':
32
32
  if TheoryManager.__instance is None:
33
33
  TheoryManager.__instance = TheoryManager()
34
34
  return TheoryManager.__instance
@@ -1,5 +0,0 @@
1
-
2
- [dev]
3
- build
4
- setuptools
5
- twine
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes