pUnit 1.3.7__tar.gz → 1.4.3__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.4.3/.scripts/punit +9 -0
- {punit-1.3.7/src/pUnit.egg-info → punit-1.4.3}/PKG-INFO +4 -6
- {punit-1.3.7 → punit-1.4.3}/README.md +1 -1
- {punit-1.3.7 → punit-1.4.3}/pyproject.toml +3 -5
- {punit-1.3.7 → punit-1.4.3/src/pUnit.egg-info}/PKG-INFO +4 -6
- {punit-1.3.7 → punit-1.4.3}/src/punit/__init__.py +2 -2
- {punit-1.3.7 → punit-1.4.3}/src/punit/__main__.py +18 -7
- {punit-1.3.7 → punit-1.4.3}/src/punit/assertions/exceptions.py +11 -3
- {punit-1.3.7 → punit-1.4.3}/src/punit/cli.py +4 -4
- {punit-1.3.7 → punit-1.4.3}/src/punit/filters/FilterManager.py +3 -3
- {punit-1.3.7 → punit-1.4.3}/src/punit/reports/HtmlReportGenerator.py +2 -1
- punit-1.3.7/.scripts/punit +0 -8
- {punit-1.3.7 → punit-1.4.3}/LICENSE +0 -0
- {punit-1.3.7 → punit-1.4.3}/setup.cfg +0 -0
- {punit-1.3.7 → punit-1.4.3}/src/pUnit.egg-info/SOURCES.txt +0 -0
- {punit-1.3.7 → punit-1.4.3}/src/pUnit.egg-info/dependency_links.txt +0 -0
- {punit-1.3.7 → punit-1.4.3}/src/pUnit.egg-info/requires.txt +0 -0
- {punit-1.3.7 → punit-1.4.3}/src/pUnit.egg-info/top_level.txt +0 -0
- {punit-1.3.7 → punit-1.4.3}/src/punit/TestResult.py +0 -0
- {punit-1.3.7 → punit-1.4.3}/src/punit/assertions/__init__.py +0 -0
- {punit-1.3.7 → punit-1.4.3}/src/punit/assertions/collections.py +0 -0
- {punit-1.3.7 → punit-1.4.3}/src/punit/assertions/strings.py +0 -0
- {punit-1.3.7 → punit-1.4.3}/src/punit/discovery/TestModuleDiscovery.py +0 -0
- {punit-1.3.7 → punit-1.4.3}/src/punit/discovery/__init__.py +0 -0
- {punit-1.3.7 → punit-1.4.3}/src/punit/facts/Fact.py +0 -0
- {punit-1.3.7 → punit-1.4.3}/src/punit/facts/FactManager.py +0 -0
- {punit-1.3.7 → punit-1.4.3}/src/punit/facts/__init__.py +0 -0
- {punit-1.3.7 → punit-1.4.3}/src/punit/filters/Filter.py +0 -0
- {punit-1.3.7 → punit-1.4.3}/src/punit/filters/__init__.py +0 -0
- {punit-1.3.7 → punit-1.4.3}/src/punit/metadata/CallableMetadata.py +0 -0
- {punit-1.3.7 → punit-1.4.3}/src/punit/metadata/__init__.py +0 -0
- {punit-1.3.7 → punit-1.4.3}/src/punit/py.typed +0 -0
- {punit-1.3.7 → punit-1.4.3}/src/punit/reports/JUnitReportGenerator.py +0 -0
- {punit-1.3.7 → punit-1.4.3}/src/punit/reports/JsonReportGenerator.py +0 -0
- {punit-1.3.7 → punit-1.4.3}/src/punit/reports/__init__.py +0 -0
- {punit-1.3.7 → punit-1.4.3}/src/punit/runner.py +0 -0
- {punit-1.3.7 → punit-1.4.3}/src/punit/theories/Theory.py +0 -0
- {punit-1.3.7 → punit-1.4.3}/src/punit/theories/TheoryManager.py +0 -0
- {punit-1.3.7 → punit-1.4.3}/src/punit/theories/__init__.py +0 -0
- {punit-1.3.7 → punit-1.4.3}/src/punit/traits/Trait.py +0 -0
- {punit-1.3.7 → punit-1.4.3}/src/punit/traits/TraitManager.py +0 -0
- {punit-1.3.7 → punit-1.4.3}/src/punit/traits/__init__.py +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# SPDX-FileCopyrightText: © 2026 Shaun Wilson
|
|
3
|
+
# SPDX-License-Identifier: MIT
|
|
4
|
+
##
|
|
5
|
+
from subprocess import run
|
|
6
|
+
from sys import executable, argv
|
|
7
|
+
from os import _exit
|
|
8
|
+
result = run([executable, "-m", "punit"] + argv[1:], check=False)
|
|
9
|
+
_exit(result.returncode)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pUnit
|
|
3
|
-
Version: 1.3
|
|
3
|
+
Version: 1.4.3
|
|
4
4
|
Summary: A modernized unit-test framework for Python.
|
|
5
5
|
Author-email: Shaun Wilson <mrshaunwilson@msn.com>
|
|
6
6
|
License: MIT License
|
|
@@ -30,12 +30,10 @@ Project-URL: Homepage, https://github.com/wilson0x4d/punit
|
|
|
30
30
|
Project-URL: Repository, https://github.com/wilson0x4d/punit.git
|
|
31
31
|
Keywords: test,unittest,unit-test,xUnit,nUnit,pytest
|
|
32
32
|
Classifier: Operating System :: OS Independent
|
|
33
|
-
Classifier: Programming Language :: Python
|
|
34
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
35
|
-
Classifier: Programming Language :: Python :: 3.14
|
|
33
|
+
Classifier: Programming Language :: Python
|
|
36
34
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
37
35
|
Classifier: Intended Audience :: Developers
|
|
38
|
-
Requires-Python: >=3.
|
|
36
|
+
Requires-Python: >=3.11
|
|
39
37
|
Description-Content-Type: text/markdown
|
|
40
38
|
License-File: LICENSE
|
|
41
39
|
Provides-Extra: dev
|
|
@@ -196,7 +194,7 @@ You will want to take particular note of the `--exclude` command-line parameter
|
|
|
196
194
|
|
|
197
195
|
The long-term vision is to provide both imperative and declarative syntaxes for testing while keeping `pUnit` as simple as possible in its implementation.
|
|
198
196
|
|
|
199
|
-
`pUnit` is a Python 3.
|
|
197
|
+
`pUnit` is a Python 3.11+ package and there are no plans to backport it to earlier versions of Python, however, user requests (with proposed changes) _will be accepted_ when it makes sense (for example, `pUnit` currently supports Python 3.11, but originally only supported Python 3.12.)
|
|
200
198
|
|
|
201
199
|
As Python progresses so will `pUnit` and SEMVER rules will be respected to provide developers with assurance that a major version of `pUnit` is fit for a particular purpose, thus, if there is ever a breaking change in Python that requires a breaking change in `pUnit` you can expect `pUnit` versioning to reflect this.
|
|
202
200
|
|
|
@@ -150,7 +150,7 @@ You will want to take particular note of the `--exclude` command-line parameter
|
|
|
150
150
|
|
|
151
151
|
The long-term vision is to provide both imperative and declarative syntaxes for testing while keeping `pUnit` as simple as possible in its implementation.
|
|
152
152
|
|
|
153
|
-
`pUnit` is a Python 3.
|
|
153
|
+
`pUnit` is a Python 3.11+ package and there are no plans to backport it to earlier versions of Python, however, user requests (with proposed changes) _will be accepted_ when it makes sense (for example, `pUnit` currently supports Python 3.11, but originally only supported Python 3.12.)
|
|
154
154
|
|
|
155
155
|
As Python progresses so will `pUnit` and SEMVER rules will be respected to provide developers with assurance that a major version of `pUnit` is fit for a particular purpose, thus, if there is ever a breaking change in Python that requires a breaking change in `pUnit` you can expect `pUnit` versioning to reflect this.
|
|
156
156
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "pUnit"
|
|
3
|
-
version = "1.3
|
|
3
|
+
version = "1.4.3"
|
|
4
4
|
description = "A modernized unit-test framework for Python."
|
|
5
5
|
keywords = ["test", "unittest", "unit-test", "xUnit", "nUnit", "pytest"]
|
|
6
6
|
authors = [
|
|
@@ -8,12 +8,10 @@ authors = [
|
|
|
8
8
|
]
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = {file = "LICENSE"}
|
|
11
|
-
requires-python = ">=3.
|
|
11
|
+
requires-python = ">=3.11"
|
|
12
12
|
classifiers = [
|
|
13
13
|
"Operating System :: OS Independent",
|
|
14
|
-
"Programming Language :: Python
|
|
15
|
-
"Programming Language :: Python :: 3.13",
|
|
16
|
-
"Programming Language :: Python :: 3.14",
|
|
14
|
+
"Programming Language :: Python",
|
|
17
15
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
18
16
|
"Intended Audience :: Developers"
|
|
19
17
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pUnit
|
|
3
|
-
Version: 1.3
|
|
3
|
+
Version: 1.4.3
|
|
4
4
|
Summary: A modernized unit-test framework for Python.
|
|
5
5
|
Author-email: Shaun Wilson <mrshaunwilson@msn.com>
|
|
6
6
|
License: MIT License
|
|
@@ -30,12 +30,10 @@ Project-URL: Homepage, https://github.com/wilson0x4d/punit
|
|
|
30
30
|
Project-URL: Repository, https://github.com/wilson0x4d/punit.git
|
|
31
31
|
Keywords: test,unittest,unit-test,xUnit,nUnit,pytest
|
|
32
32
|
Classifier: Operating System :: OS Independent
|
|
33
|
-
Classifier: Programming Language :: Python
|
|
34
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
35
|
-
Classifier: Programming Language :: Python :: 3.14
|
|
33
|
+
Classifier: Programming Language :: Python
|
|
36
34
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
37
35
|
Classifier: Intended Audience :: Developers
|
|
38
|
-
Requires-Python: >=3.
|
|
36
|
+
Requires-Python: >=3.11
|
|
39
37
|
Description-Content-Type: text/markdown
|
|
40
38
|
License-File: LICENSE
|
|
41
39
|
Provides-Extra: dev
|
|
@@ -196,7 +194,7 @@ You will want to take particular note of the `--exclude` command-line parameter
|
|
|
196
194
|
|
|
197
195
|
The long-term vision is to provide both imperative and declarative syntaxes for testing while keeping `pUnit` as simple as possible in its implementation.
|
|
198
196
|
|
|
199
|
-
`pUnit` is a Python 3.
|
|
197
|
+
`pUnit` is a Python 3.11+ package and there are no plans to backport it to earlier versions of Python, however, user requests (with proposed changes) _will be accepted_ when it makes sense (for example, `pUnit` currently supports Python 3.11, but originally only supported Python 3.12.)
|
|
200
198
|
|
|
201
199
|
As Python progresses so will `pUnit` and SEMVER rules will be respected to provide developers with assurance that a major version of `pUnit` is fit for a particular purpose, thus, if there is ever a breaking change in Python that requires a breaking change in `pUnit` you can expect `pUnit` versioning to reflect this.
|
|
202
200
|
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import asyncio
|
|
5
5
|
import os
|
|
6
|
+
import sys
|
|
6
7
|
import time
|
|
7
8
|
from .cli import CommandLineInterface
|
|
8
9
|
from .discovery import TestModuleDiscovery
|
|
@@ -13,11 +14,11 @@ from .runner import TestRunner
|
|
|
13
14
|
async def async_main() -> None:
|
|
14
15
|
ts = time.time()
|
|
15
16
|
cli = CommandLineInterface.parse()
|
|
16
|
-
if cli.help:
|
|
17
|
+
if cli.help: # pragma: no cover
|
|
17
18
|
cli.printHelp()
|
|
18
|
-
elif cli.verbose and not cli.quiet:
|
|
19
|
+
elif cli.verbose and not cli.quiet: # pragma: no cover
|
|
19
20
|
cli.printSummary()
|
|
20
|
-
elif not cli.quiet:
|
|
21
|
+
elif not cli.quiet: # pragma: no cover
|
|
21
22
|
cli.printVersion()
|
|
22
23
|
os.chdir(cli.workdir)
|
|
23
24
|
testModuleDiscovery = TestModuleDiscovery(
|
|
@@ -32,11 +33,11 @@ async def async_main() -> None:
|
|
|
32
33
|
failureCount = 0
|
|
33
34
|
for result in results:
|
|
34
35
|
if not result.isSuccess:
|
|
35
|
-
failureCount += 1
|
|
36
|
+
failureCount += 1 # pragma: no cover
|
|
36
37
|
if not cli.quiet:
|
|
37
38
|
print(f'Total: {len(results)}, Failures: {failureCount}, Took: {totalTime:.3f}s')
|
|
38
|
-
if cli.reportFormat is not None:
|
|
39
|
-
report:str = ''
|
|
39
|
+
if cli.reportFormat is not None: # pragma: no cover
|
|
40
|
+
report: str = ''
|
|
40
41
|
match cli.reportFormat:
|
|
41
42
|
case 'html':
|
|
42
43
|
report = HtmlReportGenerator().generate(results)
|
|
@@ -52,10 +53,20 @@ async def async_main() -> None:
|
|
|
52
53
|
file.write(report.encode())
|
|
53
54
|
print(f'\n("{cli.reportFormat}" report written to: {cli.outputFilename})')
|
|
54
55
|
if failureCount > 0:
|
|
55
|
-
|
|
56
|
+
sys.stdout.flush()
|
|
57
|
+
sys.stderr.flush()
|
|
58
|
+
try:
|
|
59
|
+
os.fsync(sys.stdout.fileno())
|
|
60
|
+
os.fsync(sys.stderr.fileno())
|
|
61
|
+
except (AttributeError, ValueError, OSError):
|
|
62
|
+
# Pass if the stream doesn't support fsync (e.g. some virtualized environments)
|
|
63
|
+
pass
|
|
64
|
+
os._exit(119) # pragma: no cover
|
|
65
|
+
|
|
56
66
|
|
|
57
67
|
def main() -> None:
|
|
58
68
|
asyncio.run(async_main())
|
|
59
69
|
|
|
70
|
+
|
|
60
71
|
if (__name__ == '__main__'):
|
|
61
72
|
main()
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: ©
|
|
1
|
+
# SPDX-FileCopyrightText: © 2026 Shaun Wilson
|
|
2
2
|
# SPDX-License-Identifier: MIT
|
|
3
3
|
|
|
4
|
-
from typing import Any, Callable, Optional, cast, get_args
|
|
4
|
+
from typing import Any, Callable, Generic, Optional, TypeVar, cast, get_args
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
TError = TypeVar('TError', bound=Exception)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class raises(Generic[TError]):
|
|
8
11
|
|
|
9
12
|
__action:Callable
|
|
10
13
|
__exact:bool
|
|
@@ -27,3 +30,8 @@ class raises[TError:Exception]:
|
|
|
27
30
|
elif expected is not None:
|
|
28
31
|
return issubclass(type(ex), cast(Any,expected))
|
|
29
32
|
return False
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
__all__ = [
|
|
36
|
+
'raises'
|
|
37
|
+
]
|
|
@@ -100,7 +100,7 @@ class CommandLineInterface:
|
|
|
100
100
|
case _:
|
|
101
101
|
print(f'Unsupported value "{arg}" for --report argument, aborting.')
|
|
102
102
|
print(f'(valid values are "json" and "junit")')
|
|
103
|
-
|
|
103
|
+
os._exit(4)
|
|
104
104
|
continue
|
|
105
105
|
elif extractOutputFilename:
|
|
106
106
|
extractOutputFilename = False
|
|
@@ -260,7 +260,7 @@ Options:
|
|
|
260
260
|
suppress any program output.
|
|
261
261
|
"""
|
|
262
262
|
)
|
|
263
|
-
|
|
263
|
+
os._exit(0)
|
|
264
264
|
|
|
265
265
|
def printSummary(self) -> None:
|
|
266
266
|
self.printVersion()
|
|
@@ -282,10 +282,10 @@ Options:
|
|
|
282
282
|
def validate(self) -> None:
|
|
283
283
|
if self.__workdir is None or len(self.__workdir.lstrip()) == 0 or self.__workdir.startswith('-'):
|
|
284
284
|
print(f'Invalid working directory specified: {self.__workdir}')
|
|
285
|
-
|
|
285
|
+
os._exit(1)
|
|
286
286
|
elif not os.path.isdir(self.__workdir):
|
|
287
287
|
print(f'Working directory does not exist: {self.__workdir}')
|
|
288
|
-
|
|
288
|
+
os._exit(2)
|
|
289
289
|
self.__workdir = os.path.abspath(self.__workdir)
|
|
290
290
|
if not self.__no_default_patterns:
|
|
291
291
|
# if no other patterns specified, default to including all files found in the directory matching `testPackageName`
|
|
@@ -45,15 +45,15 @@ class FilterManager:
|
|
|
45
45
|
ready, _, _ = select.select([sys.stdin], [], [], 5)
|
|
46
46
|
if not ready:
|
|
47
47
|
print('No data from stdin, aborting.')
|
|
48
|
-
|
|
48
|
+
os._exit(7)
|
|
49
49
|
lines = sys.stdin.read().splitlines()
|
|
50
50
|
if len(lines) == 0:
|
|
51
51
|
print('No filters from stdin, aborting.')
|
|
52
|
-
|
|
52
|
+
os._exit(6)
|
|
53
53
|
else:
|
|
54
54
|
if not os.path.exists(filepath):
|
|
55
55
|
print(f'file missing or not accessible: {filepath}')
|
|
56
|
-
|
|
56
|
+
os._exit(5)
|
|
57
57
|
with open(filepath, 'rb') as f:
|
|
58
58
|
lines = f.read().decode().splitlines()
|
|
59
59
|
for line in lines:
|
|
@@ -81,7 +81,8 @@ class HtmlReportGenerator:
|
|
|
81
81
|
if testResult.exception is not None:
|
|
82
82
|
if len(f'{testResult.exception}') > 0:
|
|
83
83
|
lines.append(f'Error:<br/> {testResult.exception}<br/>')
|
|
84
|
-
|
|
84
|
+
tbstr = "".join(traceback.format_tb(testResult.exception.__traceback__)).replace('\n', '<br/>').replace(' ', ' ')
|
|
85
|
+
lines.append(f'Traceback:<br/>{tbstr}')
|
|
85
86
|
lines.append('</pre></div>')
|
|
86
87
|
if testResult.stdout is not None:
|
|
87
88
|
lines.append(f'<div class="testresult-stdout"><pre>{testResult.stdout}</pre></div>')
|
punit-1.3.7/.scripts/punit
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
# SPDX-FileCopyrightText: © 2026 Shaun Wilson
|
|
3
|
-
# SPDX-License-Identifier: MIT
|
|
4
|
-
##
|
|
5
|
-
from subprocess import run
|
|
6
|
-
from sys import executable, argv, exit
|
|
7
|
-
result = run([ executable, "-m", "punit" ] + argv[1:], check=False)
|
|
8
|
-
exit(result.returncode)
|
|
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
|