punit 1.8.1__tar.gz → 1.9.2__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.8.1/src/pUnit.egg-info → punit-1.9.2}/PKG-INFO +2 -1
- {punit-1.8.1 → punit-1.9.2}/pyproject.toml +2 -1
- {punit-1.8.1 → punit-1.9.2/src/pUnit.egg-info}/PKG-INFO +2 -1
- {punit-1.8.1 → punit-1.9.2}/src/pUnit.egg-info/requires.txt +1 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/__init__.py +2 -2
- {punit-1.8.1 → punit-1.9.2}/src/punit/__main__.py +23 -7
- {punit-1.8.1 → punit-1.9.2}/src/punit/cli.py +22 -2
- {punit-1.8.1 → punit-1.9.2}/src/punit/runner.py +10 -4
- {punit-1.8.1 → punit-1.9.2}/LICENSE +0 -0
- {punit-1.8.1 → punit-1.9.2}/README.md +0 -0
- {punit-1.8.1 → punit-1.9.2}/setup.cfg +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/pUnit.egg-info/SOURCES.txt +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/pUnit.egg-info/dependency_links.txt +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/pUnit.egg-info/entry_points.txt +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/pUnit.egg-info/top_level.txt +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/TestResult.py +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/assertions/__init__.py +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/assertions/collections.py +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/assertions/exceptions.py +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/assertions/numeric.py +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/assertions/strings.py +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/discovery/TestModuleDiscovery.py +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/discovery/__init__.py +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/facts/Fact.py +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/facts/FactManager.py +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/facts/__init__.py +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/filters/Filter.py +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/filters/FilterManager.py +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/filters/__init__.py +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/metadata/CallableMetadata.py +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/metadata/__init__.py +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/py.typed +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/reports/HtmlReportGenerator.py +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/reports/JUnitReportGenerator.py +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/reports/JsonReportGenerator.py +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/reports/__init__.py +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/results/__init__.py +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/results/fails.py +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/setups/Setup.py +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/setups/SetupManager.py +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/setups/__init__.py +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/teardowns/Teardown.py +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/teardowns/TeardownManager.py +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/teardowns/__init__.py +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/theories/Theory.py +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/theories/TheoryManager.py +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/theories/__init__.py +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/traits/Trait.py +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/traits/TraitManager.py +0 -0
- {punit-1.8.1 → punit-1.9.2}/src/punit/traits/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pUnit
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.9.2
|
|
4
4
|
Summary: A modernized unit-test framework for Python.
|
|
5
5
|
Author-email: Shaun Wilson <mrshaunwilson@msn.com>
|
|
6
6
|
License: MIT License
|
|
@@ -36,6 +36,7 @@ Classifier: Intended Audience :: Developers
|
|
|
36
36
|
Requires-Python: >=3.11
|
|
37
37
|
Description-Content-Type: text/markdown
|
|
38
38
|
License-File: LICENSE
|
|
39
|
+
Requires-Dist: hazrakah
|
|
39
40
|
Provides-Extra: dev
|
|
40
41
|
Requires-Dist: coverage; extra == "dev"
|
|
41
42
|
Requires-Dist: mypy; extra == "dev"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "pUnit"
|
|
3
|
-
version = "1.
|
|
3
|
+
version = "1.9.2"
|
|
4
4
|
description = "A modernized unit-test framework for Python."
|
|
5
5
|
keywords = ["test", "unittest", "unit-test", "xUnit", "nUnit", "pytest"]
|
|
6
6
|
authors = [
|
|
@@ -16,6 +16,7 @@ classifiers = [
|
|
|
16
16
|
"Intended Audience :: Developers"
|
|
17
17
|
]
|
|
18
18
|
dependencies = [
|
|
19
|
+
"hazrakah"
|
|
19
20
|
]
|
|
20
21
|
|
|
21
22
|
[project.optional-dependencies]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pUnit
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.9.2
|
|
4
4
|
Summary: A modernized unit-test framework for Python.
|
|
5
5
|
Author-email: Shaun Wilson <mrshaunwilson@msn.com>
|
|
6
6
|
License: MIT License
|
|
@@ -36,6 +36,7 @@ Classifier: Intended Audience :: Developers
|
|
|
36
36
|
Requires-Python: >=3.11
|
|
37
37
|
Description-Content-Type: text/markdown
|
|
38
38
|
License-File: LICENSE
|
|
39
|
+
Requires-Dist: hazrakah
|
|
39
40
|
Provides-Extra: dev
|
|
40
41
|
Requires-Dist: coverage; extra == "dev"
|
|
41
42
|
Requires-Dist: mypy; extra == "dev"
|
|
@@ -9,10 +9,12 @@ from pathlib import Path
|
|
|
9
9
|
|
|
10
10
|
from .cli import CommandLineInterface
|
|
11
11
|
from .discovery import TestModuleDiscovery
|
|
12
|
+
from .facts.FactManager import FactManager
|
|
12
13
|
from .reports import HtmlReportGenerator, JUnitReportGenerator, JsonReportGenerator
|
|
13
14
|
from .runner import TestRunner
|
|
14
15
|
from .setups.SetupManager import SetupManager
|
|
15
16
|
from .teardowns.TeardownManager import TeardownManager
|
|
17
|
+
from .theories.TheoryManager import TheoryManager
|
|
16
18
|
|
|
17
19
|
|
|
18
20
|
async def async_main() -> None:
|
|
@@ -32,13 +34,27 @@ async def async_main() -> None:
|
|
|
32
34
|
sys.path.append(src_path)
|
|
33
35
|
if cwd_path not in sys.path:
|
|
34
36
|
sys.path.append(cwd_path)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
cli.
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
test_runner: TestRunner
|
|
38
|
+
if cli.files:
|
|
39
|
+
dotnames = []
|
|
40
|
+
for filepath in cli.files:
|
|
41
|
+
rel = os.path.relpath(os.path.abspath(filepath), cli.workdir)
|
|
42
|
+
dotnames.append(
|
|
43
|
+
rel[:-3].replace('\\', '/').replace('/', '.')
|
|
44
|
+
)
|
|
45
|
+
FactManager.instance().excludeTraits = cli.excludeTraits
|
|
46
|
+
FactManager.instance().includeTraits = cli.includeTraits
|
|
47
|
+
TheoryManager.instance().excludeTraits = cli.excludeTraits
|
|
48
|
+
TheoryManager.instance().includeTraits = cli.includeTraits
|
|
49
|
+
test_runner = TestRunner('', dotnames, cli)
|
|
50
|
+
else:
|
|
51
|
+
test_module_discovery = TestModuleDiscovery(
|
|
52
|
+
os.path.join(cli.workdir, cli.test_package_name),
|
|
53
|
+
cli.includePatterns,
|
|
54
|
+
cli.excludePatterns,
|
|
55
|
+
cli)
|
|
56
|
+
test_module_discovery.discover()
|
|
57
|
+
test_runner = TestRunner(cli.test_package_name, test_module_discovery.filenames, cli)
|
|
42
58
|
results = await test_runner.run()
|
|
43
59
|
total_time = time.time() - start_time
|
|
44
60
|
failure_count = 0
|
|
@@ -43,6 +43,7 @@ class CommandLineInterface:
|
|
|
43
43
|
__test_package_name: str | None
|
|
44
44
|
__verbose: bool
|
|
45
45
|
__workdir: str | None
|
|
46
|
+
__files: list[str]
|
|
46
47
|
|
|
47
48
|
def __init__(self) -> None:
|
|
48
49
|
self.__aliases = dict[str, str]()
|
|
@@ -61,6 +62,7 @@ class CommandLineInterface:
|
|
|
61
62
|
self.__test_package_name = 'tests'
|
|
62
63
|
self.__workdir = os.path.curdir
|
|
63
64
|
self.__verbose = False
|
|
65
|
+
self.__files = []
|
|
64
66
|
|
|
65
67
|
def __parse(self, argv: list[str]) -> CommandLineInterface:
|
|
66
68
|
"""
|
|
@@ -111,6 +113,9 @@ class CommandLineInterface:
|
|
|
111
113
|
extractAliasPath = False
|
|
112
114
|
self.__aliases[aliasName] = arg
|
|
113
115
|
continue
|
|
116
|
+
elif arg.endswith('.py') and not arg.startswith('-'):
|
|
117
|
+
self.__files.append(arg)
|
|
118
|
+
continue
|
|
114
119
|
elif self.__workdir is None:
|
|
115
120
|
self.__workdir = arg
|
|
116
121
|
continue
|
|
@@ -239,10 +244,14 @@ class CommandLineInterface:
|
|
|
239
244
|
def no_pathfix(self) -> bool:
|
|
240
245
|
return self.__no_pathfix
|
|
241
246
|
|
|
247
|
+
@property
|
|
248
|
+
def files(self) -> list[str]:
|
|
249
|
+
return self.__files
|
|
250
|
+
|
|
242
251
|
def print_help(self) -> None:
|
|
243
252
|
self.print_version()
|
|
244
253
|
print("""
|
|
245
|
-
Usage: python3 -m punit [-h|--help]
|
|
254
|
+
Usage: python3 -m punit [-h|--help] [FILE ...]
|
|
246
255
|
[-q|--quiet] [-v|--verbose]
|
|
247
256
|
[-z|--failfast]
|
|
248
257
|
[-p|--test-package NAME]
|
|
@@ -299,6 +308,12 @@ Options:
|
|
|
299
308
|
If `--report` is used, instead of writing to stdout
|
|
300
309
|
write to FILENAME. In this case `--report` does not
|
|
301
310
|
suppress any program output.
|
|
311
|
+
FILE
|
|
312
|
+
One or more .py files to run directly.
|
|
313
|
+
When any FILE is specified, only those files are tested;
|
|
314
|
+
-p/--test-package, --include, and --exclude patterns on
|
|
315
|
+
discovered files are ignored (test filtering via -f/-t
|
|
316
|
+
still applies).
|
|
302
317
|
""")
|
|
303
318
|
os._exit(0)
|
|
304
319
|
|
|
@@ -333,9 +348,14 @@ Options:
|
|
|
333
348
|
self.__includePatterns.append('*.py')
|
|
334
349
|
# always exclude dunder files
|
|
335
350
|
self.__excludePatterns.append('/__*__')
|
|
351
|
+
if self.__files:
|
|
352
|
+
for fpath in self.__files:
|
|
353
|
+
if not os.path.isfile(fpath):
|
|
354
|
+
print(f'File not found: {fpath}')
|
|
355
|
+
os._exit(1)
|
|
336
356
|
|
|
337
357
|
@staticmethod
|
|
338
|
-
def parse(argv: list[str] = sys.argv) -> CommandLineInterface:
|
|
358
|
+
def parse(argv: list[str] = sys.argv[1:]) -> CommandLineInterface:
|
|
339
359
|
result = CommandLineInterface().__parse(argv)
|
|
340
360
|
result.validate()
|
|
341
361
|
return result
|
|
@@ -233,13 +233,19 @@ class TestRunner:
|
|
|
233
233
|
test_package_path = os.path.join(os.path.abspath(os.curdir), self.__test_package_name).replace('\\', '/')
|
|
234
234
|
for filename in self.__filenames:
|
|
235
235
|
ts = time.time()
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
236
|
+
if not self.__test_package_name:
|
|
237
|
+
module_import_name = filename
|
|
238
|
+
else:
|
|
239
|
+
module_import_name = filename.replace(test_package_path, '').replace('/', '.')
|
|
240
|
+
if module_import_name.endswith('.py'):
|
|
241
|
+
module_import_name = module_import_name[:-3]
|
|
239
242
|
module_report_name = module_import_name.lstrip('.')
|
|
240
243
|
try:
|
|
241
244
|
host_name: str = socket.gethostname()
|
|
242
|
-
|
|
245
|
+
if not self.__test_package_name:
|
|
246
|
+
test_module = importlib.import_module(module_import_name)
|
|
247
|
+
else:
|
|
248
|
+
test_module = importlib.import_module(module_import_name, self.__test_package_name)
|
|
243
249
|
|
|
244
250
|
# execute all facts
|
|
245
251
|
await self.__run_facts(host_name, test_module, filename, module_report_name, results)
|
|
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
|
|
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
|