poodle 1.0.0__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.
- poodle-1.0.0/LICENSE +21 -0
- poodle-1.0.0/PKG-INFO +115 -0
- poodle-1.0.0/README.md +73 -0
- poodle-1.0.0/pyproject.toml +160 -0
- poodle-1.0.0/setup.cfg +4 -0
- poodle-1.0.0/src/poodle/__init__.py +29 -0
- poodle-1.0.0/src/poodle/cli.py +58 -0
- poodle-1.0.0/src/poodle/config.py +480 -0
- poodle-1.0.0/src/poodle/core.py +63 -0
- poodle-1.0.0/src/poodle/data_types/__init__.py +5 -0
- poodle-1.0.0/src/poodle/data_types/data.py +129 -0
- poodle-1.0.0/src/poodle/data_types/interfaces.py +139 -0
- poodle-1.0.0/src/poodle/data_types/work.py +68 -0
- poodle-1.0.0/src/poodle/mutate.py +213 -0
- poodle-1.0.0/src/poodle/mutators/__init__.py +7 -0
- poodle-1.0.0/src/poodle/mutators/calls.py +113 -0
- poodle-1.0.0/src/poodle/mutators/compare.py +90 -0
- poodle-1.0.0/src/poodle/mutators/constant.py +100 -0
- poodle-1.0.0/src/poodle/mutators/operators.py +140 -0
- poodle-1.0.0/src/poodle/mutators/unary_op.py +40 -0
- poodle-1.0.0/src/poodle/report.py +33 -0
- poodle-1.0.0/src/poodle/reporters/__init__.py +3 -0
- poodle-1.0.0/src/poodle/reporters/basic.py +99 -0
- poodle-1.0.0/src/poodle/run.py +183 -0
- poodle-1.0.0/src/poodle/runners/__init__.py +1 -0
- poodle-1.0.0/src/poodle/runners/command_line.py +77 -0
- poodle-1.0.0/src/poodle/util.py +80 -0
- poodle-1.0.0/src/poodle.egg-info/PKG-INFO +115 -0
- poodle-1.0.0/src/poodle.egg-info/SOURCES.txt +36 -0
- poodle-1.0.0/src/poodle.egg-info/dependency_links.txt +1 -0
- poodle-1.0.0/src/poodle.egg-info/entry_points.txt +2 -0
- poodle-1.0.0/src/poodle.egg-info/requires.txt +5 -0
- poodle-1.0.0/src/poodle.egg-info/top_level.txt +1 -0
- poodle-1.0.0/tests/test_config.py +1137 -0
- poodle-1.0.0/tests/test_core.py +249 -0
- poodle-1.0.0/tests/test_mutate.py +331 -0
- poodle-1.0.0/tests/test_report.py +39 -0
- poodle-1.0.0/tests/test_util.py +161 -0
poodle-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 WiredNerd
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
poodle-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: poodle
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Mutation Testing Tool
|
|
5
|
+
Author-email: WiredNerd <pbuschmail-poodle@yahoo.com>
|
|
6
|
+
Maintainer-email: WiredNerd <pbuschmail-poodle@yahoo.com>
|
|
7
|
+
License: MIT License
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2023 WiredNerd
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
|
28
|
+
|
|
29
|
+
Project-URL: Documentation, https://poodle.readthedocs.io/
|
|
30
|
+
Project-URL: Homepage, https://github.com/WiredNerd/poodle
|
|
31
|
+
Project-URL: Issue Tracker, https://github.com/WiredNerd/poodle/issues
|
|
32
|
+
Keywords: test,coverage,quality,mutation,pytest,pit,pitest,pittest,mutmut,mutatest
|
|
33
|
+
Classifier: Programming Language :: Python :: 3
|
|
34
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
35
|
+
Classifier: Operating System :: OS Independent
|
|
36
|
+
Requires-Python: >=3.9
|
|
37
|
+
Description-Content-Type: text/markdown
|
|
38
|
+
License-File: LICENSE
|
|
39
|
+
Requires-Dist: click>=8
|
|
40
|
+
Requires-Dist: wcmatch>=8.5
|
|
41
|
+
Requires-Dist: tomli>=2; python_version < "3.11"
|
|
42
|
+
|
|
43
|
+
[](https://github.com/WiredNerd/poodle)
|
|
44
|
+
[](https://pypi.org/project/poodle)
|
|
45
|
+
[](https://pypi.org/project/poodle)
|
|
46
|
+
[](https://pypi.org/project/poodle)
|
|
47
|
+
[](https://github.com/WiredNerd/poodle/blob/main/LICENSE)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
[](https://pytest-cov.readthedocs.io)
|
|
51
|
+
[](https://poodle.readthedocs.io/)
|
|
52
|
+
<!-- [div(%2F%2Ftestsuites%5B1%5D%2F%40tests%20-%20%2F%2Ftestsuites%5B1%5D%2F%40disabled)*100)&suffix=%25&label=Mutation%20Coverage&color=orange)](https://mutmut.readthedocs.io/) -->
|
|
53
|
+
|
|
54
|
+
[](https://pycqa.github.io/isort/)
|
|
55
|
+
[](https://black.readthedocs.io)
|
|
56
|
+
[](https://beta.ruff.rs/docs/)
|
|
57
|
+
<!-- [](https://snyk.io/) -->
|
|
58
|
+
|
|
59
|
+
# Poodle
|
|
60
|
+
|
|
61
|
+
Poodle is an tool for Mutation Testing your Python projects.
|
|
62
|
+
|
|
63
|
+
Mutation Testing proves the quality of your test suite by introducing bugs in your application, then verifying if your test cases can find the bug.
|
|
64
|
+
|
|
65
|
+
## Features
|
|
66
|
+
|
|
67
|
+
The goal of Poodle is to be highly efficient, configurable, and extendable.
|
|
68
|
+
|
|
69
|
+
* Multi-Threaded execution
|
|
70
|
+
* Highly Configurable (toml and py)
|
|
71
|
+
* Plug in custom code
|
|
72
|
+
|
|
73
|
+
## Quick Start
|
|
74
|
+
|
|
75
|
+
Installation:
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
pip install poodle --upgrade
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
Usage: poodle [OPTIONS] [SOURCES]...
|
|
83
|
+
|
|
84
|
+
Poodle Mutation Test Tool.
|
|
85
|
+
|
|
86
|
+
Options:
|
|
87
|
+
-c PATH Configuration File.
|
|
88
|
+
-q Quiet mode: q, qq, or qq
|
|
89
|
+
-v Verbose mode: v, vv, or vvv
|
|
90
|
+
-w INTEGER Maximum number of parallel workers.
|
|
91
|
+
--exclude TEXT Add a regex exclude file filter. Multiple allowed.
|
|
92
|
+
--only TEXT Glob pattern for files to mutate. Multiple allowed.
|
|
93
|
+
--help Show this message and exit.
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Documentation:
|
|
97
|
+
|
|
98
|
+
- https://poodle.readthedocs.io/
|
|
99
|
+
|
|
100
|
+
## Contribute
|
|
101
|
+
|
|
102
|
+
- Issue Tracker: https://github.com/WiredNerd/poodle/issues
|
|
103
|
+
- Source Code: https://github.com/WiredNerd/poodle
|
|
104
|
+
|
|
105
|
+
## Support
|
|
106
|
+
|
|
107
|
+
If you are having issues, please let us know.
|
|
108
|
+
|
|
109
|
+
I can be contacted at: pbuschmail-poodle@yahoo.com
|
|
110
|
+
|
|
111
|
+
Or by opening an issue: https://github.com/WiredNerd/poodle/issues
|
|
112
|
+
|
|
113
|
+
## License
|
|
114
|
+
|
|
115
|
+
The project is licensed under the MIT license.
|
poodle-1.0.0/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
[](https://github.com/WiredNerd/poodle)
|
|
2
|
+
[](https://pypi.org/project/poodle)
|
|
3
|
+
[](https://pypi.org/project/poodle)
|
|
4
|
+
[](https://pypi.org/project/poodle)
|
|
5
|
+
[](https://github.com/WiredNerd/poodle/blob/main/LICENSE)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
[](https://pytest-cov.readthedocs.io)
|
|
9
|
+
[](https://poodle.readthedocs.io/)
|
|
10
|
+
<!-- [div(%2F%2Ftestsuites%5B1%5D%2F%40tests%20-%20%2F%2Ftestsuites%5B1%5D%2F%40disabled)*100)&suffix=%25&label=Mutation%20Coverage&color=orange)](https://mutmut.readthedocs.io/) -->
|
|
11
|
+
|
|
12
|
+
[](https://pycqa.github.io/isort/)
|
|
13
|
+
[](https://black.readthedocs.io)
|
|
14
|
+
[](https://beta.ruff.rs/docs/)
|
|
15
|
+
<!-- [](https://snyk.io/) -->
|
|
16
|
+
|
|
17
|
+
# Poodle
|
|
18
|
+
|
|
19
|
+
Poodle is an tool for Mutation Testing your Python projects.
|
|
20
|
+
|
|
21
|
+
Mutation Testing proves the quality of your test suite by introducing bugs in your application, then verifying if your test cases can find the bug.
|
|
22
|
+
|
|
23
|
+
## Features
|
|
24
|
+
|
|
25
|
+
The goal of Poodle is to be highly efficient, configurable, and extendable.
|
|
26
|
+
|
|
27
|
+
* Multi-Threaded execution
|
|
28
|
+
* Highly Configurable (toml and py)
|
|
29
|
+
* Plug in custom code
|
|
30
|
+
|
|
31
|
+
## Quick Start
|
|
32
|
+
|
|
33
|
+
Installation:
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
pip install poodle --upgrade
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
Usage: poodle [OPTIONS] [SOURCES]...
|
|
41
|
+
|
|
42
|
+
Poodle Mutation Test Tool.
|
|
43
|
+
|
|
44
|
+
Options:
|
|
45
|
+
-c PATH Configuration File.
|
|
46
|
+
-q Quiet mode: q, qq, or qq
|
|
47
|
+
-v Verbose mode: v, vv, or vvv
|
|
48
|
+
-w INTEGER Maximum number of parallel workers.
|
|
49
|
+
--exclude TEXT Add a regex exclude file filter. Multiple allowed.
|
|
50
|
+
--only TEXT Glob pattern for files to mutate. Multiple allowed.
|
|
51
|
+
--help Show this message and exit.
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Documentation:
|
|
55
|
+
|
|
56
|
+
- https://poodle.readthedocs.io/
|
|
57
|
+
|
|
58
|
+
## Contribute
|
|
59
|
+
|
|
60
|
+
- Issue Tracker: https://github.com/WiredNerd/poodle/issues
|
|
61
|
+
- Source Code: https://github.com/WiredNerd/poodle
|
|
62
|
+
|
|
63
|
+
## Support
|
|
64
|
+
|
|
65
|
+
If you are having issues, please let us know.
|
|
66
|
+
|
|
67
|
+
I can be contacted at: pbuschmail-poodle@yahoo.com
|
|
68
|
+
|
|
69
|
+
Or by opening an issue: https://github.com/WiredNerd/poodle/issues
|
|
70
|
+
|
|
71
|
+
## License
|
|
72
|
+
|
|
73
|
+
The project is licensed under the MIT license.
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "poodle"
|
|
7
|
+
description = "Mutation Testing Tool"
|
|
8
|
+
version = "1.0.0"
|
|
9
|
+
license = { file = "LICENSE" }
|
|
10
|
+
keywords = [
|
|
11
|
+
"test",
|
|
12
|
+
"coverage",
|
|
13
|
+
"quality",
|
|
14
|
+
"mutation",
|
|
15
|
+
"pytest",
|
|
16
|
+
"pit",
|
|
17
|
+
"pitest",
|
|
18
|
+
"pittest",
|
|
19
|
+
"mutmut",
|
|
20
|
+
"mutatest",
|
|
21
|
+
]
|
|
22
|
+
authors = [{ name = "WiredNerd", email = "pbuschmail-poodle@yahoo.com" }]
|
|
23
|
+
maintainers = [{ name = "WiredNerd", email = "pbuschmail-poodle@yahoo.com" }]
|
|
24
|
+
readme = "README.md"
|
|
25
|
+
requires-python = ">=3.9"
|
|
26
|
+
classifiers = [
|
|
27
|
+
"Programming Language :: Python :: 3",
|
|
28
|
+
"License :: OSI Approved :: MIT License",
|
|
29
|
+
"Operating System :: OS Independent",
|
|
30
|
+
]
|
|
31
|
+
dependencies = ["click>=8", "wcmatch>=8.5", "tomli>=2; python_version<'3.11'"]
|
|
32
|
+
|
|
33
|
+
[project.urls]
|
|
34
|
+
"Documentation" = "https://poodle.readthedocs.io/"
|
|
35
|
+
"Homepage" = "https://github.com/WiredNerd/poodle"
|
|
36
|
+
"Issue Tracker" = "https://github.com/WiredNerd/poodle/issues"
|
|
37
|
+
|
|
38
|
+
[project.scripts]
|
|
39
|
+
poodle = "poodle.cli:main"
|
|
40
|
+
|
|
41
|
+
[tool.setuptools]
|
|
42
|
+
|
|
43
|
+
[tool.pytest.ini_options]
|
|
44
|
+
pythonpath = ["src"]
|
|
45
|
+
testpaths = ["tests"]
|
|
46
|
+
addopts = "-vv --cov-reset --cov-report=html:reports/coverage --cov-report=term --cov-report=json:code-coverage.json"
|
|
47
|
+
sort_mode = "random"
|
|
48
|
+
sort_bucket = "session"
|
|
49
|
+
filterwarnings = [
|
|
50
|
+
"ignore:.*cannot collect test class .TestingSummary",
|
|
51
|
+
"ignore:.*cannot collect test class .TestingResults",
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
[tool.poodle]
|
|
55
|
+
file_filters = ["test_*.py", "*_test.py", 'cli.py', 'run.py', '__init__.py']
|
|
56
|
+
|
|
57
|
+
[tool.poodle.runner_opts]
|
|
58
|
+
|
|
59
|
+
[tool.coverage.run]
|
|
60
|
+
branch = true
|
|
61
|
+
|
|
62
|
+
[tool.coverage.report]
|
|
63
|
+
skip_empty = true
|
|
64
|
+
exclude_also = ["import .*", "from .* import .*", "if TYPE_CHECKING:"]
|
|
65
|
+
|
|
66
|
+
[tool.black]
|
|
67
|
+
line-length = 120
|
|
68
|
+
target-version = ['py39', 'py310', 'py311']
|
|
69
|
+
color = true
|
|
70
|
+
|
|
71
|
+
[tool.isort]
|
|
72
|
+
profile = 'black'
|
|
73
|
+
line_length = 120
|
|
74
|
+
py_version = 39
|
|
75
|
+
|
|
76
|
+
[tool.mypy]
|
|
77
|
+
files = "poodle"
|
|
78
|
+
mypy_path = "src,tests"
|
|
79
|
+
|
|
80
|
+
[tool.ruff]
|
|
81
|
+
target-version = "py39"
|
|
82
|
+
show-source = true
|
|
83
|
+
select = ["ALL"]
|
|
84
|
+
ignore = [
|
|
85
|
+
"COM812", # missing-trailing-comma
|
|
86
|
+
"D203", # 1 blank line required before class docstring
|
|
87
|
+
"D213", # multi-line-summary-second-line
|
|
88
|
+
"EM101", # Exception must not use a string literal, assign to variable first
|
|
89
|
+
"FBT001", # Boolean-typed positional argument in function definition
|
|
90
|
+
"FBT002", # Boolean default positional argument in function definition
|
|
91
|
+
"FIX002", # Found a TODO
|
|
92
|
+
"TD002", # Missing author in TODO
|
|
93
|
+
"TD003", # Missing issue link on the line following this TODO
|
|
94
|
+
"TRY003", # Avoid specifying long messages outside the exception class
|
|
95
|
+
"ANN101", # Missing type annotation for self in method
|
|
96
|
+
"ANN102", # Missing type annotation for cls in method
|
|
97
|
+
"ANN002", # Missing type annotation for *args
|
|
98
|
+
"ANN003", # Missing type annotation for **kwargs
|
|
99
|
+
"ISC001", # single-line-implicit-string-concatenation
|
|
100
|
+
"PLR2004", # Magic value used in comparison
|
|
101
|
+
"PLR0911", # Too many return statements
|
|
102
|
+
]
|
|
103
|
+
line-length = 120
|
|
104
|
+
exclude = [
|
|
105
|
+
".eggs",
|
|
106
|
+
".git",
|
|
107
|
+
".mypy_cache",
|
|
108
|
+
".pants.d",
|
|
109
|
+
".ruff_cache",
|
|
110
|
+
".venv",
|
|
111
|
+
"__pypackages__",
|
|
112
|
+
"_build",
|
|
113
|
+
"build",
|
|
114
|
+
"dist",
|
|
115
|
+
"venv",
|
|
116
|
+
]
|
|
117
|
+
|
|
118
|
+
[tool.ruff.lint.isort]
|
|
119
|
+
known-first-party = ["poodle"]
|
|
120
|
+
|
|
121
|
+
[tool.ruff.per-file-ignores]
|
|
122
|
+
"src/*/__init__.py" = [
|
|
123
|
+
"F401", # imported but unused
|
|
124
|
+
]
|
|
125
|
+
"src/poodle/mutators/*" = [
|
|
126
|
+
"N802", # Function name should be lowercase
|
|
127
|
+
]
|
|
128
|
+
"src/poodle/cli.py" = [
|
|
129
|
+
"PLR0913", # Too many arguments in function definition
|
|
130
|
+
]
|
|
131
|
+
"src/poodle/data_types/interfaces.py" = [
|
|
132
|
+
"ARG001", # Unused function argument
|
|
133
|
+
]
|
|
134
|
+
"tests/*" = [
|
|
135
|
+
"D100", # Missing docstring in public module
|
|
136
|
+
"D101", # Missing docstring in public class
|
|
137
|
+
"D102", # Missing docstring in public method
|
|
138
|
+
"D103", # Missing docstring in public function
|
|
139
|
+
"D104", # Missing docstring in public package
|
|
140
|
+
"D106", # Missing docstring in public nested class
|
|
141
|
+
"S101", # Use of `assert` detected
|
|
142
|
+
"ANN001", # Missing type annotation for function argument
|
|
143
|
+
"ANN201", # Missing return type annotation for public function
|
|
144
|
+
"ANN202", # Missing return type annotation for private function
|
|
145
|
+
"ANN205", # Missing return type annotation for staticmethod
|
|
146
|
+
"ANN206", # Missing return type annotation for classmethod
|
|
147
|
+
"FBT003", # Boolean positional value in function call
|
|
148
|
+
"ERA001", # Found commented-out code
|
|
149
|
+
"PLR0913", # Too many arguments in function definition
|
|
150
|
+
"PLR2004", # Magic value used in comparison
|
|
151
|
+
"SLF001", # Private member accessed
|
|
152
|
+
]
|
|
153
|
+
"tests/mutators/*" = [
|
|
154
|
+
"N802", # Function name should be lowercase
|
|
155
|
+
]
|
|
156
|
+
"tests/test_core.py" = [
|
|
157
|
+
"ARG002", # Unused method argument
|
|
158
|
+
]
|
|
159
|
+
|
|
160
|
+
[tool.ruff.format]
|
poodle-1.0.0/setup.cfg
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""Poodle Mutation Test Tool."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import importlib
|
|
6
|
+
import sys
|
|
7
|
+
from contextlib import suppress
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
from typing import Any
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class PoodleInputError(ValueError):
|
|
13
|
+
"""An input value from Command Line, poodle_config.py, or a config file was invalid."""
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class PoodleTrialRunError(Exception):
|
|
17
|
+
"""An unexpected error occurred when running a mutation trial or clean run."""
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
try:
|
|
21
|
+
import tomllib # type: ignore [import-not-found]
|
|
22
|
+
except ModuleNotFoundError: # < py3.11
|
|
23
|
+
import tomli as tomllib # type: ignore [no-redef]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
poodle_config: Any = None
|
|
27
|
+
with suppress(ImportError):
|
|
28
|
+
sys.path.append(str(Path.cwd()))
|
|
29
|
+
poodle_config = importlib.import_module("poodle_config")
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"""Command Line Interface."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import sys
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
import click
|
|
9
|
+
|
|
10
|
+
from . import PoodleInputError, core
|
|
11
|
+
from .config import build_config
|
|
12
|
+
|
|
13
|
+
CONTEXT_SETTINGS = {
|
|
14
|
+
"max_content_width": 120,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@click.command(context_settings=CONTEXT_SETTINGS)
|
|
19
|
+
@click.argument("sources", type=click.Path(exists=True, path_type=Path), nargs=-1)
|
|
20
|
+
@click.option("-c", "config_file", help="Configuration File.", type=click.Path(exists=True, path_type=Path))
|
|
21
|
+
@click.option("-q", "quiet", help="Quiet mode: q, qq, or qq", count=True)
|
|
22
|
+
@click.option("-v", "verbose", help="Verbose mode: v, vv, or vvv", count=True)
|
|
23
|
+
@click.option("-w", "workers", help="Maximum number of parallel workers.", type=int)
|
|
24
|
+
@click.option("--exclude", help="Add a regex exclude file filter. Multiple allowed.", multiple=True)
|
|
25
|
+
@click.option("--only", help="Glob pattern for files to mutate. Multiple allowed.", multiple=True)
|
|
26
|
+
def main(
|
|
27
|
+
sources: tuple[Path],
|
|
28
|
+
config_file: Path | None,
|
|
29
|
+
quiet: int,
|
|
30
|
+
verbose: int,
|
|
31
|
+
workers: int | None,
|
|
32
|
+
exclude: tuple[str],
|
|
33
|
+
only: tuple[str],
|
|
34
|
+
) -> None:
|
|
35
|
+
"""Poodle Mutation Test Tool."""
|
|
36
|
+
try:
|
|
37
|
+
config = build_config(sources, config_file, quiet, verbose, workers, exclude, only)
|
|
38
|
+
except PoodleInputError as err:
|
|
39
|
+
click.echo(err.args)
|
|
40
|
+
sys.exit(4)
|
|
41
|
+
|
|
42
|
+
try:
|
|
43
|
+
core.main(config)
|
|
44
|
+
except KeyboardInterrupt:
|
|
45
|
+
click.echo("Aborted due to Keyboard Interrupt!")
|
|
46
|
+
sys.exit(2)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
# pytest return codes
|
|
50
|
+
# Exit code 0: All tests were collected and passed successfully
|
|
51
|
+
# Exit code 1: Tests were collected and run but some of the tests failed
|
|
52
|
+
# Exit code 2: Test execution was interrupted by the user
|
|
53
|
+
# Exit code 3: Internal error happened while executing tests
|
|
54
|
+
# Exit code 4: pytest command line usage error
|
|
55
|
+
# Exit code 5: No tests were collected
|
|
56
|
+
|
|
57
|
+
if __name__ == "__main__":
|
|
58
|
+
main()
|