pyproteum 0.1__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.
- pyproteum-0.1/LICENSE +22 -0
- pyproteum-0.1/PKG-INFO +235 -0
- pyproteum-0.1/README.md +220 -0
- pyproteum-0.1/pyproject.toml +21 -0
- pyproteum-0.1/pyproteum/__init__.py +1 -0
- pyproteum-0.1/pyproteum/__main__.py +22 -0
- pyproteum-0.1/pyproteum/exemuta.py +316 -0
- pyproteum-0.1/pyproteum/models/models.py +89 -0
- pyproteum-0.1/pyproteum/moperators/cccr.py +34 -0
- pyproteum-0.1/pyproteum/moperators/ccsr.py +56 -0
- pyproteum-0.1/pyproteum/moperators/crcr.py +33 -0
- pyproteum-0.1/pyproteum/moperators/myoperator.py +155 -0
- pyproteum-0.1/pyproteum/moperators/oaaa.py +42 -0
- pyproteum-0.1/pyproteum/moperators/oaan.py +41 -0
- pyproteum-0.1/pyproteum/moperators/oeap.py +94 -0
- pyproteum-0.1/pyproteum/moperators/oodl.py +85 -0
- pyproteum-0.1/pyproteum/moperators/oplist.py +70 -0
- pyproteum-0.1/pyproteum/moperators/orrn.py +55 -0
- pyproteum-0.1/pyproteum/moperators/sbrc.py +25 -0
- pyproteum-0.1/pyproteum/moperators/scrb.py +25 -0
- pyproteum-0.1/pyproteum/moperators/ssdl.py +41 -0
- pyproteum-0.1/pyproteum/mutagen.py +176 -0
- pyproteum-0.1/pyproteum/mutaview.py +283 -0
- pyproteum-0.1/pyproteum/mutaviewgui.py +289 -0
- pyproteum-0.1/pyproteum/print_visit.py +675 -0
- pyproteum-0.1/pyproteum/tcase.py +202 -0
- pyproteum-0.1/pyproteum/testnew.py +87 -0
- pyproteum-0.1/pyproteum.egg-info/PKG-INFO +235 -0
- pyproteum-0.1/pyproteum.egg-info/SOURCES.txt +33 -0
- pyproteum-0.1/pyproteum.egg-info/dependency_links.txt +1 -0
- pyproteum-0.1/pyproteum.egg-info/entry_points.txt +2 -0
- pyproteum-0.1/pyproteum.egg-info/requires.txt +2 -0
- pyproteum-0.1/pyproteum.egg-info/top_level.txt +2 -0
- pyproteum-0.1/setup.cfg +4 -0
- pyproteum-0.1/setup.py +15 -0
pyproteum-0.1/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Marcio Delamaro
|
|
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.
|
|
22
|
+
|
pyproteum-0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyproteum
|
|
3
|
+
Version: 0.1
|
|
4
|
+
Summary: A tool for mutation testing in Python. Implemented as a Python module.
|
|
5
|
+
Author: Delamaro
|
|
6
|
+
Author-email: Delamaro <delamaro@icmc.usp.br>
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: timeout-decorator
|
|
11
|
+
Requires-Dist: peewee
|
|
12
|
+
Dynamic: author
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
Dynamic: requires-python
|
|
15
|
+
|
|
16
|
+
# pyproteum
|
|
17
|
+
|
|
18
|
+
*A mutation testing toolkit for Python. Implemented as a Python module.*
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
*It is based on Proteum (Program Testing Using Mutants) , the first widely used mutation tool, developed for C.*
|
|
22
|
+
|
|
23
|
+
*https://link.springer.com/book/10.1007/978-1-4757-5939-6*
|
|
24
|
+
|
|
25
|
+
> **Status:** early preview — core mutation operators are available; more coming soon.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Features
|
|
30
|
+
|
|
31
|
+
- Parse Python source code and generate mutants using configurable operators
|
|
32
|
+
- Run your test suite against each mutant (kill/survive reporting)
|
|
33
|
+
- Simple CLI
|
|
34
|
+
|
|
35
|
+
## Requirements
|
|
36
|
+
|
|
37
|
+
- Python >= 3.10
|
|
38
|
+
- Dependencies: `timeout-decorator`, `peewee`
|
|
39
|
+
*(Note: `pickle` is part of the Python standard library and does not need to be installed.)*
|
|
40
|
+
|
|
41
|
+
## Installation
|
|
42
|
+
|
|
43
|
+
### From PyPI (once published)
|
|
44
|
+
```bash
|
|
45
|
+
pip install pyproteum
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
# pyproteum — Command Line Guide
|
|
50
|
+
|
|
51
|
+
`pyproteum` uses the concept of a **test session**.
|
|
52
|
+
To use the tool, follow these steps:
|
|
53
|
+
|
|
54
|
+
1. **Create a test session** specifying which source files will be tested (mutated).
|
|
55
|
+
2. **Add test cases** from `unittest` test files.
|
|
56
|
+
3. **Generate mutants** from the selected source files.
|
|
57
|
+
4. **Execute the generated mutants** against the test cases.
|
|
58
|
+
|
|
59
|
+
This cycle can be repeated multiple times — you can remove existing test cases, add new ones, and generate additional mutants as needed.
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
## Mutation operators (currently implemented)
|
|
64
|
+
|
|
65
|
+
| Name | Description |
|
|
66
|
+
|------|-------------|
|
|
67
|
+
| cccr | Constant by Constant Replacement |
|
|
68
|
+
| ccsr | Constant by Scalar Replacement |
|
|
69
|
+
| crcr | Required Constant Replacement |
|
|
70
|
+
| oaaa | Replace arithmetic assignment operator by other arithmetic assignment operator |
|
|
71
|
+
| oaan | Replace arithmetic operator by other arithmetic operator |
|
|
72
|
+
| oeap | Replace augmented assignment by plain assignment |
|
|
73
|
+
| oepa | Replace plain assignment by augmented assignment |
|
|
74
|
+
| oodl | Operator deletion |
|
|
75
|
+
| orrn | Replace relational operator (<, >, <=, >=, ==, !=) by other relational operator |
|
|
76
|
+
| sbrc | Replace each break statement by a continue statement |
|
|
77
|
+
| scrb | Replace each continue statement by a break statement |
|
|
78
|
+
| ssdl | Replace each statement by a pass statement |
|
|
79
|
+
|
|
80
|
+
> **Notes**
|
|
81
|
+
> `crcr` replaces literals with a small, meaningful set of alternative constants (e.g., `-1`, `0`, `1`, for integers).
|
|
82
|
+
|
|
83
|
+
> `oepa` will produce a lot of useless mutants for the assignments that initialize a variable.
|
|
84
|
+
|
|
85
|
+
## Configuration tips
|
|
86
|
+
|
|
87
|
+
- Start with a small set of operators (e.g., `orrn,crcr`) to get quick feedback.
|
|
88
|
+
- Scope your target to the most critical modules first to keep the run time manageable.
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
## Command-line tools
|
|
92
|
+
|
|
93
|
+
`pyproteum` provides 5 main subcommands:
|
|
94
|
+
|
|
95
|
+
### 1. `testnew` — Create a new test session
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
python -m pyproteum testnew --D /home/user/proteum --S foo.py foo_session
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
- Creates a test session in the specified directory (`--D`) for the file `foo.py`, naming the session `foo_session`.
|
|
102
|
+
|
|
103
|
+
- **`--D`**: base directory where the session will be created. All file names are relative to this directory.
|
|
104
|
+
Example: the source file in this case would be `/home/user/proteum/foo.py`.
|
|
105
|
+
- **`--S`**: specifies the source file(s) to be mutated; can be repeated multiple times.
|
|
106
|
+
If not provided, defaults to `<session_name>.py`.
|
|
107
|
+
|
|
108
|
+
- **`--test`** or **`--research`**: exactly one must be used.
|
|
109
|
+
>`--test`: each mutant is executed until the first test case kills it.
|
|
110
|
+
>`--research`: each mutant is executed against *all* test cases in the session.
|
|
111
|
+
> If omitted, `--test` is assumed.
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
### 2. `tcase` — Manage test case files in a session
|
|
116
|
+
|
|
117
|
+
Add a `unittest` test file:
|
|
118
|
+
```bash
|
|
119
|
+
python -m pyproteum tcase --add --D /home/user/proteum --S test_foo.py foo_session
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Remove a test file:
|
|
123
|
+
```bash
|
|
124
|
+
python -m pyproteum tcase --del --D /home/user/proteum --S test_foo.py foo_session
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
List all test files and test cases in a session:
|
|
128
|
+
```bash
|
|
129
|
+
python -m pyproteum tcase --list --D /home/user/proteum foo_session
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
### 3. `mutagen` — Generate mutants
|
|
135
|
+
|
|
136
|
+
Generate mutants for all operators:
|
|
137
|
+
```bash
|
|
138
|
+
python -m pyproteum mutagen --create --D /home/user/proteum foo_session
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Generate only `ssdl` mutants, with 50% random sampling:
|
|
142
|
+
```bash
|
|
143
|
+
python -m pyproteum mutagen --create --D /home/user/proteum --ssdl 50 foo_session
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Notes:
|
|
147
|
+
|
|
148
|
+
- You can specify multiple operators in the same command.
|
|
149
|
+
- You can use --all to sample all operators.
|
|
150
|
+
- You can specify a seed for sampling, Using the same seed generates the same mutants. Use: `--seed <integer number>.`
|
|
151
|
+
- Partial operator names are allowed. For example, `--c` selects all constant-related operators (those starting with `c`).
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
### 4. `exemuta` — Execute mutants
|
|
156
|
+
|
|
157
|
+
Run generated mutants against the current test set:
|
|
158
|
+
```bash
|
|
159
|
+
python -m pyproteum exemuta --exec --D /home/user/proteum foo_session
|
|
160
|
+
```
|
|
161
|
+
Set mutants as equivalents:
|
|
162
|
+
```bash
|
|
163
|
+
python -m pyproteum exemuta --equiv --D /home/user/proteum --x "1 4 44" foo_session
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Generate a CSV table of results:
|
|
167
|
+
```bash
|
|
168
|
+
python -m pyproteum exemuta --csv --D /home/user/proteum --O foo.csv foo_session
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
- Each row corresponds to a mutant; each column corresponds to a test case.
|
|
172
|
+
- **`--O`** sets the CSV output filename. If omitted, defaults to `<session_name>.csv`.
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
### 5. `mutaview` — View mutants
|
|
177
|
+
|
|
178
|
+
Show original vs. mutated code in the terminal:
|
|
179
|
+
```bash
|
|
180
|
+
python -m pyproteum mutaview --view --D /home/user/proteum --x 1 foo_session
|
|
181
|
+
```
|
|
182
|
+
- `--x` specifies the mutant number to display. It can be a list of numbers like --x "1 2 3 4 5".
|
|
183
|
+
|
|
184
|
+
Generate a `.py` file with the mutant's code:
|
|
185
|
+
```bash
|
|
186
|
+
python -m pyproteum mutaview --build --D /home/user/proteum --x 1 foo_session
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
- The output file will be named `foo_session_mutant0001.py` in this example.
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
List all mutants and their current status
|
|
193
|
+
```bash
|
|
194
|
+
python -m pyproteum mutaview --list --D /home/user/proteum foo_session
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Show mutants in a GUI interface. Allows to compare with original code and set mutant as equivalent.
|
|
198
|
+
```bash
|
|
199
|
+
python -m pyproteum mutaview --gui --D /home/user/proteum foo_session
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## Workflow summary
|
|
205
|
+
|
|
206
|
+
1. `testnew` → create a session
|
|
207
|
+
2. `tcase` → add/remove/list test files
|
|
208
|
+
3. `mutagen` → generate mutants
|
|
209
|
+
4. `exemuta` → execute mutants & get results
|
|
210
|
+
5. `mutaview` → inspect mutants
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
## Contributing
|
|
214
|
+
|
|
215
|
+
Contributions are welcome! Please open an issue describing the change you’d like to make or the bug you found. If you’re adding a new operator, include:
|
|
216
|
+
|
|
217
|
+
1. Operator name, short key, and rationale
|
|
218
|
+
2. AST node types affected and transformation rules
|
|
219
|
+
3. Unit tests that both generate the mutant and exercise its effects
|
|
220
|
+
|
|
221
|
+
## License
|
|
222
|
+
|
|
223
|
+
MIT
|
|
224
|
+
|
|
225
|
+
## Citation
|
|
226
|
+
|
|
227
|
+
If this toolkit helps your research or teaching, consider citing the project as:
|
|
228
|
+
|
|
229
|
+
```
|
|
230
|
+
Delamaro, M. (2025). pyproteum: a mutation testing toolkit for Python. Version 0.1.
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
Questions, ideas, or bugs? Open an issue or ping us .
|
pyproteum-0.1/README.md
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
# pyproteum
|
|
2
|
+
|
|
3
|
+
*A mutation testing toolkit for Python. Implemented as a Python module.*
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
*It is based on Proteum (Program Testing Using Mutants) , the first widely used mutation tool, developed for C.*
|
|
7
|
+
|
|
8
|
+
*https://link.springer.com/book/10.1007/978-1-4757-5939-6*
|
|
9
|
+
|
|
10
|
+
> **Status:** early preview — core mutation operators are available; more coming soon.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Features
|
|
15
|
+
|
|
16
|
+
- Parse Python source code and generate mutants using configurable operators
|
|
17
|
+
- Run your test suite against each mutant (kill/survive reporting)
|
|
18
|
+
- Simple CLI
|
|
19
|
+
|
|
20
|
+
## Requirements
|
|
21
|
+
|
|
22
|
+
- Python >= 3.10
|
|
23
|
+
- Dependencies: `timeout-decorator`, `peewee`
|
|
24
|
+
*(Note: `pickle` is part of the Python standard library and does not need to be installed.)*
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
### From PyPI (once published)
|
|
29
|
+
```bash
|
|
30
|
+
pip install pyproteum
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
# pyproteum — Command Line Guide
|
|
35
|
+
|
|
36
|
+
`pyproteum` uses the concept of a **test session**.
|
|
37
|
+
To use the tool, follow these steps:
|
|
38
|
+
|
|
39
|
+
1. **Create a test session** specifying which source files will be tested (mutated).
|
|
40
|
+
2. **Add test cases** from `unittest` test files.
|
|
41
|
+
3. **Generate mutants** from the selected source files.
|
|
42
|
+
4. **Execute the generated mutants** against the test cases.
|
|
43
|
+
|
|
44
|
+
This cycle can be repeated multiple times — you can remove existing test cases, add new ones, and generate additional mutants as needed.
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
## Mutation operators (currently implemented)
|
|
49
|
+
|
|
50
|
+
| Name | Description |
|
|
51
|
+
|------|-------------|
|
|
52
|
+
| cccr | Constant by Constant Replacement |
|
|
53
|
+
| ccsr | Constant by Scalar Replacement |
|
|
54
|
+
| crcr | Required Constant Replacement |
|
|
55
|
+
| oaaa | Replace arithmetic assignment operator by other arithmetic assignment operator |
|
|
56
|
+
| oaan | Replace arithmetic operator by other arithmetic operator |
|
|
57
|
+
| oeap | Replace augmented assignment by plain assignment |
|
|
58
|
+
| oepa | Replace plain assignment by augmented assignment |
|
|
59
|
+
| oodl | Operator deletion |
|
|
60
|
+
| orrn | Replace relational operator (<, >, <=, >=, ==, !=) by other relational operator |
|
|
61
|
+
| sbrc | Replace each break statement by a continue statement |
|
|
62
|
+
| scrb | Replace each continue statement by a break statement |
|
|
63
|
+
| ssdl | Replace each statement by a pass statement |
|
|
64
|
+
|
|
65
|
+
> **Notes**
|
|
66
|
+
> `crcr` replaces literals with a small, meaningful set of alternative constants (e.g., `-1`, `0`, `1`, for integers).
|
|
67
|
+
|
|
68
|
+
> `oepa` will produce a lot of useless mutants for the assignments that initialize a variable.
|
|
69
|
+
|
|
70
|
+
## Configuration tips
|
|
71
|
+
|
|
72
|
+
- Start with a small set of operators (e.g., `orrn,crcr`) to get quick feedback.
|
|
73
|
+
- Scope your target to the most critical modules first to keep the run time manageable.
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
## Command-line tools
|
|
77
|
+
|
|
78
|
+
`pyproteum` provides 5 main subcommands:
|
|
79
|
+
|
|
80
|
+
### 1. `testnew` — Create a new test session
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
python -m pyproteum testnew --D /home/user/proteum --S foo.py foo_session
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
- Creates a test session in the specified directory (`--D`) for the file `foo.py`, naming the session `foo_session`.
|
|
87
|
+
|
|
88
|
+
- **`--D`**: base directory where the session will be created. All file names are relative to this directory.
|
|
89
|
+
Example: the source file in this case would be `/home/user/proteum/foo.py`.
|
|
90
|
+
- **`--S`**: specifies the source file(s) to be mutated; can be repeated multiple times.
|
|
91
|
+
If not provided, defaults to `<session_name>.py`.
|
|
92
|
+
|
|
93
|
+
- **`--test`** or **`--research`**: exactly one must be used.
|
|
94
|
+
>`--test`: each mutant is executed until the first test case kills it.
|
|
95
|
+
>`--research`: each mutant is executed against *all* test cases in the session.
|
|
96
|
+
> If omitted, `--test` is assumed.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
### 2. `tcase` — Manage test case files in a session
|
|
101
|
+
|
|
102
|
+
Add a `unittest` test file:
|
|
103
|
+
```bash
|
|
104
|
+
python -m pyproteum tcase --add --D /home/user/proteum --S test_foo.py foo_session
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Remove a test file:
|
|
108
|
+
```bash
|
|
109
|
+
python -m pyproteum tcase --del --D /home/user/proteum --S test_foo.py foo_session
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
List all test files and test cases in a session:
|
|
113
|
+
```bash
|
|
114
|
+
python -m pyproteum tcase --list --D /home/user/proteum foo_session
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
### 3. `mutagen` — Generate mutants
|
|
120
|
+
|
|
121
|
+
Generate mutants for all operators:
|
|
122
|
+
```bash
|
|
123
|
+
python -m pyproteum mutagen --create --D /home/user/proteum foo_session
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Generate only `ssdl` mutants, with 50% random sampling:
|
|
127
|
+
```bash
|
|
128
|
+
python -m pyproteum mutagen --create --D /home/user/proteum --ssdl 50 foo_session
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Notes:
|
|
132
|
+
|
|
133
|
+
- You can specify multiple operators in the same command.
|
|
134
|
+
- You can use --all to sample all operators.
|
|
135
|
+
- You can specify a seed for sampling, Using the same seed generates the same mutants. Use: `--seed <integer number>.`
|
|
136
|
+
- Partial operator names are allowed. For example, `--c` selects all constant-related operators (those starting with `c`).
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
### 4. `exemuta` — Execute mutants
|
|
141
|
+
|
|
142
|
+
Run generated mutants against the current test set:
|
|
143
|
+
```bash
|
|
144
|
+
python -m pyproteum exemuta --exec --D /home/user/proteum foo_session
|
|
145
|
+
```
|
|
146
|
+
Set mutants as equivalents:
|
|
147
|
+
```bash
|
|
148
|
+
python -m pyproteum exemuta --equiv --D /home/user/proteum --x "1 4 44" foo_session
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Generate a CSV table of results:
|
|
152
|
+
```bash
|
|
153
|
+
python -m pyproteum exemuta --csv --D /home/user/proteum --O foo.csv foo_session
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
- Each row corresponds to a mutant; each column corresponds to a test case.
|
|
157
|
+
- **`--O`** sets the CSV output filename. If omitted, defaults to `<session_name>.csv`.
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
### 5. `mutaview` — View mutants
|
|
162
|
+
|
|
163
|
+
Show original vs. mutated code in the terminal:
|
|
164
|
+
```bash
|
|
165
|
+
python -m pyproteum mutaview --view --D /home/user/proteum --x 1 foo_session
|
|
166
|
+
```
|
|
167
|
+
- `--x` specifies the mutant number to display. It can be a list of numbers like --x "1 2 3 4 5".
|
|
168
|
+
|
|
169
|
+
Generate a `.py` file with the mutant's code:
|
|
170
|
+
```bash
|
|
171
|
+
python -m pyproteum mutaview --build --D /home/user/proteum --x 1 foo_session
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
- The output file will be named `foo_session_mutant0001.py` in this example.
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
List all mutants and their current status
|
|
178
|
+
```bash
|
|
179
|
+
python -m pyproteum mutaview --list --D /home/user/proteum foo_session
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Show mutants in a GUI interface. Allows to compare with original code and set mutant as equivalent.
|
|
183
|
+
```bash
|
|
184
|
+
python -m pyproteum mutaview --gui --D /home/user/proteum foo_session
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Workflow summary
|
|
190
|
+
|
|
191
|
+
1. `testnew` → create a session
|
|
192
|
+
2. `tcase` → add/remove/list test files
|
|
193
|
+
3. `mutagen` → generate mutants
|
|
194
|
+
4. `exemuta` → execute mutants & get results
|
|
195
|
+
5. `mutaview` → inspect mutants
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
## Contributing
|
|
199
|
+
|
|
200
|
+
Contributions are welcome! Please open an issue describing the change you’d like to make or the bug you found. If you’re adding a new operator, include:
|
|
201
|
+
|
|
202
|
+
1. Operator name, short key, and rationale
|
|
203
|
+
2. AST node types affected and transformation rules
|
|
204
|
+
3. Unit tests that both generate the mutant and exercise its effects
|
|
205
|
+
|
|
206
|
+
## License
|
|
207
|
+
|
|
208
|
+
MIT
|
|
209
|
+
|
|
210
|
+
## Citation
|
|
211
|
+
|
|
212
|
+
If this toolkit helps your research or teaching, consider citing the project as:
|
|
213
|
+
|
|
214
|
+
```
|
|
215
|
+
Delamaro, M. (2025). pyproteum: a mutation testing toolkit for Python. Version 0.1.
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
Questions, ideas, or bugs? Open an issue or ping us .
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pyproteum"
|
|
7
|
+
version = "0.1"
|
|
8
|
+
description = "A tool for mutation testing in Python. Implemented as a Python module."
|
|
9
|
+
authors = [
|
|
10
|
+
{name = "Delamaro", email = "delamaro@icmc.usp.br"}
|
|
11
|
+
]
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
requires-python = ">=3.10"
|
|
14
|
+
dependencies = [
|
|
15
|
+
"timeout-decorator",
|
|
16
|
+
"peewee"
|
|
17
|
+
]
|
|
18
|
+
scripts = { pyproteum = "pyproteum.__main__:main" }
|
|
19
|
+
|
|
20
|
+
[tool.setuptools.packages.find]
|
|
21
|
+
where = ["."]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from pyproteum import testnew, tcase, mutagen, exemuta, mutaview
|
|
2
|
+
import sys
|
|
3
|
+
|
|
4
|
+
if __name__ == '__main__':
|
|
5
|
+
del sys.argv[0]
|
|
6
|
+
if sys.argv ==[]:
|
|
7
|
+
print('You should use one of the pyproteum commands.')
|
|
8
|
+
else:
|
|
9
|
+
match sys.argv[0]:
|
|
10
|
+
case 'testnew':
|
|
11
|
+
testnew.main()
|
|
12
|
+
case 'tcase':
|
|
13
|
+
tcase.main()
|
|
14
|
+
case 'mutagen':
|
|
15
|
+
mutagen.main()
|
|
16
|
+
case 'exemuta':
|
|
17
|
+
exemuta.main()
|
|
18
|
+
case 'mutaview':
|
|
19
|
+
mutaview.main()
|
|
20
|
+
case _:
|
|
21
|
+
print(f'Not found statement {sys.argv[0]}')
|
|
22
|
+
|