punit 1.2.8__tar.gz → 1.2.11__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.8/src/pUnit.egg-info → punit-1.2.11}/PKG-INFO +2 -1
  2. {punit-1.2.8 → punit-1.2.11}/pyproject.toml +2 -1
  3. {punit-1.2.8 → punit-1.2.11/src/pUnit.egg-info}/PKG-INFO +2 -1
  4. {punit-1.2.8 → punit-1.2.11}/src/pUnit.egg-info/requires.txt +1 -0
  5. {punit-1.2.8 → punit-1.2.11}/src/punit/__init__.py +3 -2
  6. {punit-1.2.8 → punit-1.2.11}/src/punit/__main__.py +6 -6
  7. {punit-1.2.8 → punit-1.2.11}/src/punit/assertions/exceptions.py +0 -8
  8. {punit-1.2.8 → punit-1.2.11}/src/punit/cli.py +7 -5
  9. {punit-1.2.8 → punit-1.2.11}/src/punit/facts/FactManager.py +6 -6
  10. {punit-1.2.8 → punit-1.2.11}/src/punit/reports/HtmlReportGenerator.py +1 -4
  11. {punit-1.2.8 → punit-1.2.11}/src/punit/reports/JUnitReportGenerator.py +0 -3
  12. {punit-1.2.8 → punit-1.2.11}/src/punit/theories/TheoryManager.py +9 -8
  13. {punit-1.2.8 → punit-1.2.11}/.scripts/punit +0 -0
  14. {punit-1.2.8 → punit-1.2.11}/LICENSE +0 -0
  15. {punit-1.2.8 → punit-1.2.11}/README.md +0 -0
  16. {punit-1.2.8 → punit-1.2.11}/setup.cfg +0 -0
  17. {punit-1.2.8 → punit-1.2.11}/src/pUnit.egg-info/SOURCES.txt +0 -0
  18. {punit-1.2.8 → punit-1.2.11}/src/pUnit.egg-info/dependency_links.txt +0 -0
  19. {punit-1.2.8 → punit-1.2.11}/src/pUnit.egg-info/top_level.txt +0 -0
  20. {punit-1.2.8 → punit-1.2.11}/src/punit/TestResult.py +0 -0
  21. {punit-1.2.8 → punit-1.2.11}/src/punit/assertions/__init__.py +0 -0
  22. {punit-1.2.8 → punit-1.2.11}/src/punit/assertions/collections.py +0 -0
  23. {punit-1.2.8 → punit-1.2.11}/src/punit/assertions/strings.py +0 -0
  24. {punit-1.2.8 → punit-1.2.11}/src/punit/discovery/TestModuleDiscovery.py +0 -0
  25. {punit-1.2.8 → punit-1.2.11}/src/punit/discovery/__init__.py +0 -0
  26. {punit-1.2.8 → punit-1.2.11}/src/punit/facts/Fact.py +0 -0
  27. {punit-1.2.8 → punit-1.2.11}/src/punit/facts/__init__.py +0 -0
  28. {punit-1.2.8 → punit-1.2.11}/src/punit/py.typed +0 -0
  29. {punit-1.2.8 → punit-1.2.11}/src/punit/reports/__init__.py +0 -0
  30. {punit-1.2.8 → punit-1.2.11}/src/punit/runner.py +0 -0
  31. {punit-1.2.8 → punit-1.2.11}/src/punit/theories/Theory.py +0 -0
  32. {punit-1.2.8 → punit-1.2.11}/src/punit/theories/__init__.py +0 -0
  33. {punit-1.2.8 → punit-1.2.11}/src/punit/traits/Trait.py +0 -0
  34. {punit-1.2.8 → punit-1.2.11}/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.8
3
+ Version: 1.2.11
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,6 +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: coverage; extra == "dev"
42
43
  Requires-Dist: mypy; extra == "dev"
43
44
  Requires-Dist: twine; extra == "dev"
44
45
  Dynamic: license-file
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pUnit"
3
- version = "1.2.8"
3
+ version = "1.2.11"
4
4
  description = "A modernized unit-test framework for Python."
5
5
  keywords = ["test", "unittest", "unit-test", "xUnit", "nUnit", "pytest"]
6
6
  authors = [
@@ -22,6 +22,7 @@ dependencies = [
22
22
 
23
23
  [project.optional-dependencies]
24
24
  dev = [
25
+ "coverage",
25
26
  "mypy",
26
27
  "twine"
27
28
  ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pUnit
3
- Version: 1.2.8
3
+ Version: 1.2.11
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,6 +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: coverage; extra == "dev"
42
43
  Requires-Dist: mypy; extra == "dev"
43
44
  Requires-Dist: twine; extra == "dev"
44
45
  Dynamic: license-file
@@ -1,4 +1,5 @@
1
1
 
2
2
  [dev]
3
+ coverage
3
4
  mypy
4
5
  twine
@@ -1,15 +1,16 @@
1
1
  # SPDX-FileCopyrightText: © 2024 Shaun Wilson
2
2
  # SPDX-License-Identifier: MIT
3
3
 
4
- __version__ = '1.2.8'
5
-
6
4
  from .assertions import *
7
5
  from .facts import *
8
6
  from .theories import *
9
7
  from .traits import *
10
8
 
11
9
 
10
+ __version__ = '1.2.11'
11
+ __commit__ = '1f9618b'
12
12
  __all__ = [
13
+ '__version__', '__commit__',
13
14
  'assertions',
14
15
  'collections', 'exceptions', 'strings',
15
16
  'facts',
@@ -13,11 +13,11 @@ from .runner import TestRunner
13
13
  async def async_main() -> None:
14
14
  ts = time.time()
15
15
  cli = CommandLineInterface.parse()
16
- if cli.help:
16
+ if cli.help: # pragma: no cover
17
17
  cli.printHelp()
18
- elif cli.verbose and not cli.quiet:
18
+ elif cli.verbose and not cli.quiet: # pragma: no cover
19
19
  cli.printSummary()
20
- elif not cli.quiet:
20
+ elif not cli.quiet: # pragma: no cover
21
21
  cli.printVersion()
22
22
  os.chdir(cli.workdir)
23
23
  testModuleDiscovery = TestModuleDiscovery(
@@ -32,10 +32,10 @@ async def async_main() -> None:
32
32
  failureCount = 0
33
33
  for result in results:
34
34
  if not result.isSuccess:
35
- failureCount += 1
35
+ failureCount += 1 # pragma: no cover
36
36
  if not cli.quiet:
37
37
  print(f'Total: {len(results)}, Failures: {failureCount}, Took: {totalTime:.3f}s')
38
- if cli.reportFormat is not None:
38
+ if cli.reportFormat is not None: # pragma: no cover
39
39
  report:str = ''
40
40
  match cli.reportFormat:
41
41
  case 'html':
@@ -50,7 +50,7 @@ async def async_main() -> None:
50
50
  file.write(report.encode())
51
51
  print(f'\n("{cli.reportFormat}" report written to: {cli.outputFilename})')
52
52
  if failureCount > 0:
53
- exit(119)
53
+ exit(119) # pragma: no cover
54
54
 
55
55
  def main():
56
56
  asyncio.run(async_main())
@@ -4,14 +4,6 @@
4
4
  from typing import Any, Callable, Optional, cast, get_args
5
5
 
6
6
 
7
- def isNoneOrWhiteSpace(input:str):
8
- return input is None or len(input.lstrip()) == 0
9
-
10
-
11
- def isNoneOrEmpty(input:str):
12
- return input is None or len(input) == 0
13
-
14
-
15
7
  class raises[TError:Exception]:
16
8
 
17
9
  __action:Callable
@@ -4,7 +4,7 @@
4
4
  import os
5
5
  import sys
6
6
  from typing import Optional
7
- from . import __version__
7
+ from . import __version__, __commit__
8
8
  from .traits import Trait
9
9
 
10
10
 
@@ -196,9 +196,11 @@ class CommandLineInterface:
196
196
  def workdir(self) -> str:
197
197
  return os.path.curdir if self.__workdir is None else self.__workdir
198
198
 
199
+
199
200
  def printHelp(self) -> None:
200
- self.printVersion()
201
- print(
201
+ if True: # pragma: no cover
202
+ self.printVersion()
203
+ print(
202
204
  """
203
205
  Usage: python3 -m punit [-h|--help]
204
206
  [-q|--quiet] [-v|--verbose]
@@ -251,7 +253,7 @@ Options:
251
253
  suppress any program output.
252
254
  """
253
255
  )
254
- exit(0)
256
+ exit(0)
255
257
 
256
258
  def printSummary(self) -> None:
257
259
  self.printVersion()
@@ -268,7 +270,7 @@ Options:
268
270
  print('Filter Pattern:')
269
271
  print(f'\t{self.__filterPattern}')
270
272
  def printVersion(self) -> None:
271
- print(f'pUnit {__version__}')
273
+ print(f'pUnit {__version__} ({__commit__})')
272
274
 
273
275
  def validate(self) -> None:
274
276
  if self.__workdir is None or len(self.__workdir.lstrip()) == 0 or self.__workdir.startswith('-'):
@@ -20,7 +20,7 @@ class FactManager:
20
20
 
21
21
  def __init__(self):
22
22
  if FactManager.__instance is not None:
23
- raise Exception('Cannot create more than one instance of FactManager')
23
+ raise Exception('Cannot create more than one instance of FactManager') # pragma: no cover
24
24
  self.__filterPattern = None
25
25
  self.__modules = {}
26
26
  self.__traits = {}
@@ -56,13 +56,13 @@ class FactManager:
56
56
  self.__includeTraits = value
57
57
 
58
58
  def __excludeByTraits(self, fact:Fact) -> bool:
59
- if self.__excludeTraits is not None and len(self.__excludeTraits) > 0:
60
- for trait in self.__excludeTraits:
59
+ if self.excludeTraits is not None and len(self.excludeTraits) > 0:
60
+ for trait in self.excludeTraits:
61
61
  for L_trait in fact.traits:
62
62
  if trait.name == L_trait.name and (trait.value is None or (trait.value == L_trait.value)):
63
63
  return True
64
- if self.__includeTraits is not None and len(self.__includeTraits) > 0:
65
- for trait in self.__includeTraits:
64
+ if self.includeTraits is not None and len(self.includeTraits) > 0:
65
+ for trait in self.includeTraits:
66
66
  for L_trait in fact.traits:
67
67
  if trait.name == L_trait.name and (trait.value is None or (trait.value == L_trait.value)):
68
68
  return False
@@ -77,7 +77,7 @@ class FactManager:
77
77
  return l
78
78
 
79
79
  def put(self, fact:Fact) -> None:
80
- if self.__filterPattern is None or len(self.__filterPattern.findall(fact.filterName)) > 0:
80
+ if self.filterPattern is None or len(self.filterPattern.findall(fact.filterName)) > 0:
81
81
  l = self.get(fact.moduleName)
82
82
  t = self.__traits.get(fact.target)
83
83
  if t is not None:
@@ -4,10 +4,8 @@
4
4
  import traceback
5
5
  from ..TestResult import TestResult
6
6
 
7
- class HtmlReportGenerator:
8
7
 
9
- def __init__(self):
10
- pass
8
+ class HtmlReportGenerator:
11
9
 
12
10
  def generate(self, testResults:list[TestResult]) -> str:
13
11
  failureCount = 0
@@ -44,7 +42,6 @@ class HtmlReportGenerator:
44
42
  .test-time-fail { background-color: #FEE }
45
43
  </style>
46
44
  """)
47
-
48
45
  lines.append('<div class="testresults-summary">')
49
46
  lines.append('<div>&nbsp;</div>')
50
47
  lines.append(f'<div>Total Executed: <span class="pass">{totalCount-failureCount}</span></div>')
@@ -110,9 +110,6 @@ class JUnitTestSuite:
110
110
 
111
111
  class JUnitReportGenerator:
112
112
 
113
- def __init__(self):
114
- pass
115
-
116
113
  def generate(self, testResults:list[TestResult]) -> str:
117
114
  # transform to intermediary model
118
115
  testSuites:dict[str, JUnitTestSuite] = {}
@@ -21,7 +21,7 @@ class TheoryManager:
21
21
 
22
22
  def __init__(self):
23
23
  if TheoryManager.__instance is not None:
24
- raise Exception('Cannot create more than one instance of TheoryManager')
24
+ raise Exception('Cannot create more than one instance of TheoryManager') # pragma: no cover
25
25
  self.__filterPattern = None
26
26
  self.__modules = {}
27
27
  self.__datas = {}
@@ -32,9 +32,10 @@ class TheoryManager:
32
32
  if TheoryManager.__instance is None:
33
33
  TheoryManager.__instance = TheoryManager()
34
34
  return TheoryManager.__instance
35
+
35
36
  @property
36
37
  def excludeTraits(self) -> list[Trait]:
37
- return [] if self.__excludeTraits is None else self.excludeTraits
38
+ return [] if self.__excludeTraits is None else self.__excludeTraits
38
39
 
39
40
  @excludeTraits.setter
40
41
  def excludeTraits(self, value:list[Trait]) -> None:
@@ -50,20 +51,20 @@ class TheoryManager:
50
51
 
51
52
  @property
52
53
  def includeTraits(self) -> list[Trait]:
53
- return [] if self.__includeTraits is None else self.includeTraits
54
+ return [] if self.__includeTraits is None else self.__includeTraits
54
55
 
55
56
  @includeTraits.setter
56
57
  def includeTraits(self, value:list[Trait]) -> None:
57
58
  self.__includeTraits = value
58
59
 
59
60
  def __excludeByTraits(self, theory:Theory) -> bool:
60
- if self.__excludeTraits is not None and len(self.__excludeTraits) > 0:
61
- for trait in self.__excludeTraits:
61
+ if self.excludeTraits is not None and len(self.__excludeTraits) > 0:
62
+ for trait in self.excludeTraits:
62
63
  for L_trait in theory.traits:
63
64
  if trait.name == L_trait.name and (trait.value is None or (trait.value == L_trait.value)):
64
65
  return True
65
- if self.__includeTraits is not None and len(self.__includeTraits) > 0:
66
- for trait in self.__includeTraits:
66
+ if self.includeTraits is not None and len(self.includeTraits) > 0:
67
+ for trait in self.includeTraits:
67
68
  for L_trait in theory.traits:
68
69
  if trait.name == L_trait.name and (trait.value is None or (trait.value == L_trait.value)):
69
70
  return False
@@ -78,7 +79,7 @@ class TheoryManager:
78
79
  return l
79
80
 
80
81
  def put(self, theory:Theory) -> None:
81
- if self.__filterPattern is None or len(self.__filterPattern.findall(theory.filterName)) > 0:
82
+ if self.filterPattern is None or len(self.filterPattern.findall(theory.filterName)) > 0:
82
83
  l = self.get(theory.moduleName)
83
84
  d = self.__datas.get(theory.target)
84
85
  if d is not None:
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