targeted-mutation 0.1.0__py3-none-any.whl
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.
- targeted_mutation-0.1.0.dist-info/METADATA +390 -0
- targeted_mutation-0.1.0.dist-info/RECORD +20 -0
- targeted_mutation-0.1.0.dist-info/WHEEL +4 -0
- targeted_mutation-0.1.0.dist-info/entry_points.txt +4 -0
- targeted_mutation-0.1.0.dist-info/licenses/LICENSE +202 -0
- targeted_mutation_python/__init__.py +1 -0
- targeted_mutation_python/__main__.py +3 -0
- targeted_mutation_python/campaign.py +831 -0
- targeted_mutation_python/checkpoint.py +196 -0
- targeted_mutation_python/cli.py +441 -0
- targeted_mutation_python/discovery.py +605 -0
- targeted_mutation_python/forkserver.py +372 -0
- targeted_mutation_python/model.py +230 -0
- targeted_mutation_python/report.py +242 -0
- targeted_mutation_python/revert.py +73 -0
- targeted_mutation_python/runner.py +482 -0
- targeted_mutation_python/scope.py +253 -0
- targeted_mutation_python/witness.py +292 -0
- targeted_mutation_python/worker.py +836 -0
- targeted_mutation_python/workspace.py +110 -0
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: targeted-mutation
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Observation-guided mutation testing for Python and pytest
|
|
5
|
+
Project-URL: Homepage, https://github.com/t-k/targeted-mutation-python
|
|
6
|
+
Project-URL: Repository, https://github.com/t-k/targeted-mutation-python
|
|
7
|
+
Project-URL: Issues, https://github.com/t-k/targeted-mutation-python/issues
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Environment :: Console
|
|
11
|
+
Classifier: Operating System :: POSIX
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Classifier: Topic :: Software Development :: Testing
|
|
18
|
+
Requires-Python: >=3.11
|
|
19
|
+
Requires-Dist: pytest<10,>=8
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# targeted-mutation-python
|
|
23
|
+
|
|
24
|
+
[](https://pypi.org/project/targeted-mutation/)
|
|
25
|
+
[](#quick-start)
|
|
26
|
+
[](.github/workflows/ci.yml)
|
|
27
|
+
[](LICENSE)
|
|
28
|
+
|
|
29
|
+
**Targeted mutation testing for Python and pytest (`tmtpy`)**: observes the runtime values your tests pass through comparisons, synthesizes the nearest boundary and margin bugs your suite cannot distinguish, and tells you whether each surviving edit needs a missing input or a stronger assertion.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Why targeted mutation testing?
|
|
34
|
+
|
|
35
|
+
Conventional Python mutation tools (`mutmut`, `pytest-gremlins`, `cosmic-ray`) apply fixed syntactic templates (`>=` → `>`, `+` → `-`, `True` → `False`), re-run pytest across candidates, and report a flat list of `SURVIVED` mutants to diagnose by hand. That workflow leaves three structural gaps:
|
|
36
|
+
|
|
37
|
+
1. **Syntactic operator swaps miss value-level boundary and margin bugs.** Suppose `qualifies(price)` checks `price >= 5000`, and tests assert `not qualifies(4800)` and `qualifies(5000)`. Those two inputs kill both conventional operator swaps (`price > 5000` and `price < 5000`), yet `price >= 4999`—and every threshold in `4801..5000`—still passes every test. By recording exact scalar extrema when comparison probes are active, `targeted-mutation-python` computes the closed interval of undistinguished thresholds (`4801` through `5000`), IEEE-754 adjacent `float` boundaries (`math.nextafter`), and variable-RHS integer margins (`balance >= (price - 1)`) in a constant number of arithmetic operations regardless of interval width, without an SMT solver or LLM.
|
|
38
|
+
2. **`SURVIVED` conflates missing inputs with weak assertions.** Along the Reachability–Infection–Propagation–Reveal (RIPR) model, a surviving comparison mutant means either no test passed an input that changes the comparison (**`INPUT GAP`**) or the comparison flipped during a test and the suite still passed (**`ASSERTION GAP`**). `targeted-mutation-python` separates the two, records the pytest node ID where the comparison outcome diverged (when observed inside a test), and—with `--verify-witnesses` (`--suggest-assertions`)—runs a generated pytest check against both the original code and a physical source edit before marking it `[verified]`.
|
|
39
|
+
3. **Explicit determinism with sound process isolation.** By default, every trial runs in a fresh Python interpreter and an independent workspace snapshot using physical source edits. Opting into `--deterministic` skips comparison replays whose recorded exact operands prove identical outcomes (using a 3-bit order-class mask checked in Lean 4) and enables an in-memory import overlay—falling back to physical source replays when `sys.addaudithook` detects subprocess creation or uninstrumented execution of an observed project file.
|
|
40
|
+
|
|
41
|
+
| Dimension | Conventional Python mutation tools | `targeted-mutation-python` (`tmtpy`) |
|
|
42
|
+
| --- | --- | --- |
|
|
43
|
+
| **Boundary & margin discovery** | Fixed token/literal templates | Synthesizes nearest undistinguished arbitrary-precision `int` thresholds, `math.nextafter` `float` boundaries, and variable-RHS `int` margins (`a >= (b - 1)`) from runtime extrema |
|
|
44
|
+
| **Survivor diagnosis** | Generic `SURVIVED` | Separates **`INPUT GAP`** (missing boundary input + interval) from **`ASSERTION GAP`** (comparison flipped in a recorded pytest test) |
|
|
45
|
+
| **Verified assertions** | Manual inspection | `--verify-witnesses` / `--suggest-assertions` verifies ready-to-paste `assert ...` checks against original and mutated code |
|
|
46
|
+
| **Deterministic replay pruning** | Re-runs every candidate | `--deterministic` skips provably equivalent comparison replays (`[observed]`) and uses compiled import overlays |
|
|
47
|
+
| **Pull request review** | Changed-line filter | `--since REV --undo-changes` scopes to Git diffs, reverts modified change blocks (`UNTESTED CHANGE`), and flags **`WEAKENED TEST`** regressions |
|
|
48
|
+
| **Workspace & process safety** | In-place edits or shared workers | Isolated snapshots (CoW where available), process-group cleanup, and an optional guarded Linux `forkserver` |
|
|
49
|
+
| **Dependencies** | Tool-specific runners / plugins | `pytest>=8,<10` only; **no AI, no SMT solver, no native extension build** |
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Quick start
|
|
54
|
+
|
|
55
|
+
### Requirements & install
|
|
56
|
+
|
|
57
|
+
- **CPython 3.11–3.14** on **Linux or macOS** (POSIX process groups are required).
|
|
58
|
+
- **`pytest` (`>=8,<10`)** installed in the same Python environment as the target project and its test dependencies.
|
|
59
|
+
- Install the `targeted-mutation` package (providing `tmtpy`, `targeted-mutation-python`, and `targeted-mutation` entry points) into your project's virtual environment:
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
python -m pip install targeted-mutation
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
> **Security note:** Like `pytest`, `tmtpy` imports and executes target project and test code with your user permissions. Run it only on code you trust. Mutation trials execute inside temporary snapshots rather than modifying your working tree in place (only explicit `--output`, `--write-baseline`, and `--checkpoint` paths are written on the host).
|
|
66
|
+
|
|
67
|
+
### 1. Find a missing boundary input (`INPUT GAP`)
|
|
68
|
+
|
|
69
|
+
Create a small project with `src/shipping.py` and `test_shipping.py`:
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
# src/shipping.py
|
|
73
|
+
def qualifies(price):
|
|
74
|
+
return price >= 5000
|
|
75
|
+
|
|
76
|
+
def discount(cents, pct):
|
|
77
|
+
return (cents * pct) // 100
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
# test_shipping.py
|
|
82
|
+
from shipping import discount, qualifies
|
|
83
|
+
|
|
84
|
+
def test_qualifies():
|
|
85
|
+
assert not qualifies(4800)
|
|
86
|
+
assert qualifies(5000)
|
|
87
|
+
|
|
88
|
+
def test_discount():
|
|
89
|
+
assert discount(200, 15) == 30
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Run `tmtpy analyze --deterministic --verify-witnesses`:
|
|
93
|
+
|
|
94
|
+
```text
|
|
95
|
+
$ tmtpy analyze --deterministic --verify-witnesses
|
|
96
|
+
INPUT GAP src/shipping.py:2:12
|
|
97
|
+
price >= 5000 → (price >= 4999) [observed]
|
|
98
|
+
distinguishing left operand: 4999
|
|
99
|
+
undistinguished interval: 4801 through 5000
|
|
100
|
+
[verified] assert qualifies(4999) is False
|
|
101
|
+
1 sites, 2 tests, 2 killed, 1 survived, 1 replays avoided, 0 incomplete
|
|
102
|
+
$ echo $?
|
|
103
|
+
2
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
`(price > 5000)` and `(price < 5000)` were killed (`2 killed`), while `(price >= 4999)` needed zero test replays (`1 replays avoided`) because the recorded operands (`4800` and `5000`) prove identical outcomes across `4801` through `5000`. With `--verify-witnesses`, `assert qualifies(4999) is False` passed on the original source and failed at that assertion on the physical source edit. Adding `assert not qualifies(4999)` to `test_qualifies` closes every integer threshold gap on that comparison and exits `0`.
|
|
107
|
+
|
|
108
|
+
### 2. Pinpoint a weak test (`ASSERTION GAP`)
|
|
109
|
+
|
|
110
|
+
Now suppose `test_qualifies` checks `assert not qualifies(4800)` and `assert not qualifies(4999)`, and calls `qualifies(5000)` without asserting its return value. `tmtpy` separates that weak assertion from a missing input, reports the pytest node where the comparison outcome flipped, and verifies the missing check:
|
|
111
|
+
|
|
112
|
+
```text
|
|
113
|
+
$ tmtpy analyze --deterministic --suggest-assertions
|
|
114
|
+
ASSERTION GAP src/shipping.py:2:12
|
|
115
|
+
price >= 5000 → (price > 5000) [replayed]
|
|
116
|
+
observed in test_shipping.py::test_qualifies
|
|
117
|
+
[verified] assert qualifies(5000) is True
|
|
118
|
+
1 sites, 2 tests, 1 killed, 1 survived, 0 replays avoided, 0 incomplete
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### 3. Catch non-comparison bugs (`--full`)
|
|
122
|
+
|
|
123
|
+
Restoring `assert qualifies(5000)` and passing `--full` pairs comparison probes with the Python source mutation catalogue—exposing bugs such as integer truncation when dividing before multiplying (`(200 // 100) * 15 == 30`), float division (`30.0 == 30` in Python), and unguarded literal shifts (`3000 // 99 == 30`):
|
|
124
|
+
|
|
125
|
+
```text
|
|
126
|
+
$ tmtpy analyze --full --lines src/shipping.py:5
|
|
127
|
+
SOURCE SURVIVOR src/shipping.py:5:12
|
|
128
|
+
(cents * pct) // 100 → (cents * pct / 100) [source-replay]
|
|
129
|
+
SOURCE SURVIVOR src/shipping.py:5:12
|
|
130
|
+
(cents * pct) // 100 → (cents // 100 * pct) [source-replay]
|
|
131
|
+
SOURCE SURVIVOR src/shipping.py:5:29
|
|
132
|
+
100 → (99) [source-replay]
|
|
133
|
+
3 sites, 2 tests, 9 killed, 3 survived, 0 replays avoided, 0 incomplete
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Understanding findings, exit codes & reports
|
|
139
|
+
|
|
140
|
+
### Finding statuses
|
|
141
|
+
|
|
142
|
+
| Text label | JSON `status` | Meaning | What to do |
|
|
143
|
+
| --- | --- | --- | --- |
|
|
144
|
+
| **`INPUT GAP`** | `input-gap` | Recorded exact operands agree on both the original and mutated comparison (either inferred via `[observed]` under `--deterministic` or confirmed by replay). Reports `distinguishing_input` and `threshold_interval` when derivable. | Add a test with the distinguishing operand or margin (pass `--verify-survivors` to force a replay under `--deterministic`). |
|
|
145
|
+
| **`ASSERTION GAP`** | `assertion-gap` | A recorded operand pair flipped the comparison outcome (reporting `test` when observed inside a pytest item), yet the mutated test suite passed. | Strengthen assertions in the reported pytest node (use `--suggest-assertions` / `--verify-witnesses`). |
|
|
146
|
+
| **`SOURCE SURVIVOR`** | `source-survivor` | An edit executed and passed the test suite without exact comparison proof (for non-probe AST rules, `--source-only` edits, or comparisons whose observations were marked `unknown`). | Add a test that exercises and asserts the mutated expression's behavior. |
|
|
147
|
+
| **`UNTESTED CHANGE`** | `untested-change` | With `--since REV --undo-changes`, reverting a modified block in an existing tracked Python file back to `REV` was reached and still passed the suite. | Add a regression test that fails against the pre-change code, or suppress intentional refactorings with `# tmt:ignore`. |
|
|
148
|
+
| **`WEAKENED TEST`** | `weakened-test` | With `--since REV`, conventional test files changed since `REV` let an unsuppressed mutation survive (or go unreached) that the restored `REV` tests killed on current production code. | Restore the lost assertion coverage from `REV` (or pass `--no-weakened-tests` when old tests no longer apply). |
|
|
149
|
+
| **`KILLED`** | `killed` | A test that activated the mutation subsequently failed (included in JSON/JSONL; omitted from text and SARIF). | None—your suite caught the mutation. |
|
|
150
|
+
| **`UNREACHED`** | `unreached` | No selected test executed the tracked edit (hidden in text unless `--show-unreached` is passed). | Add test coverage reaching that code path. |
|
|
151
|
+
| **`ERROR` / `TIMEOUT` / `UNSTABLE` / `AUDIT DISAGREEMENT` / `WITNESS ERROR`** | `error`, `timeout`, `unstable`, `audit-disagreement`, `witness-error` *(plus reserved `not-evaluated`)* | Execution could not establish a sound verdict (e.g., unrelated test failure without activation, per-trial timeout, nondeterministic test inventory/failure on an unchanged comparison, `--audit` mismatch, or witness runner failure). Increments `incomplete` and exits `3` even when inline-suppressed, and is always shown in text and SARIF. | Fix test nondeterminism, raise `--timeout`, or inspect `detail`. |
|
|
152
|
+
|
|
153
|
+
Each result carries an `evidence` tag (`[...]` in text):
|
|
154
|
+
- `observed` — skipped under `--deterministic` because exact recorded operands prove identical comparison outcomes.
|
|
155
|
+
- `replayed` — executed through the in-memory import overlay in `--deterministic` mode.
|
|
156
|
+
- `source-replay` — executed against a physical source rewrite in an isolated snapshot.
|
|
157
|
+
- `previous-tests` — compared against conventional test files restored from `--since REV`.
|
|
158
|
+
- `static` — listed statically via `--list` without running pytest.
|
|
159
|
+
|
|
160
|
+
### Exit codes & accounting identities
|
|
161
|
+
|
|
162
|
+
| Exit code | Meaning |
|
|
163
|
+
| ---: | --- |
|
|
164
|
+
| **`0`** | Complete run with zero unsuppressed gaps (also `--help`, `version`, and `--list`) |
|
|
165
|
+
| **`1`** | Invalid CLI arguments, missing/broken `--baseline` or mismatched `--checkpoint`, or failing/inconsistent pytest baseline |
|
|
166
|
+
| **`2`** | Complete run (`incomplete == 0`) with at least one unsuppressed gap (`input-gap`, `assertion-gap`, `source-survivor`, `untested-change`, `weakened-test`) |
|
|
167
|
+
| **`3`** | Incomplete run (`incomplete > 0`); `--write-baseline` does not overwrite the baseline file |
|
|
168
|
+
| **`130`** | Interrupted by `SIGINT` or `SIGTERM` (worker process groups are terminated and reaped) |
|
|
169
|
+
|
|
170
|
+
Every JSON report (`--format json`) and JSONL `summary` row (`--format jsonl`) satisfies two exact accounting identities:
|
|
171
|
+
- `counts.mutants_run == counts.killed + counts.survived`
|
|
172
|
+
- `counts.survived == counts.survivor_breakdown.reported + counts.survivor_breakdown.suppressed`
|
|
173
|
+
|
|
174
|
+
Execution work is tracked separately in `counts.mutation_replays` (overlay runs), `counts.source_runs` (physical runs), `counts.avoided` (pruned `input-gap`s), `counts.audit_runs`, `counts.resumed` (checkpoint hits), and—when active—`counts.forkserver_runs`.
|
|
175
|
+
|
|
176
|
+
### Formats, suppressions & stable IDs
|
|
177
|
+
|
|
178
|
+
- **Terminal safety (`text`):** Strips 7-bit/8-bit ANSI escape sequences, C0/C1 control characters, Unicode BiDi overrides, and embedded newlines from untrusted project strings on `stdout` and `stderr`, while leaving string fields unstripped in `json`, `jsonl`, and `sarif`.
|
|
179
|
+
- **Versioned JSON & JSONL (`schema: 1`):** `threshold_interval` bounds and `distinguishing_input` are serialized as base-10/decimal strings (or `null` when unbounded) so arbitrary-precision Python integers beyond 64 bits never lose precision. `operands` preserves exact type tags (`int` hex, `bytes` hex, `float`, `str`).
|
|
180
|
+
- **SARIF 2.1.0 (`sarif`):** Emits unsuppressed gaps (`warning`) and unsuppressed incomplete verdicts (`error`) with `%SRCROOT%`-relative URIs, UTF-16 `startColumn`/`endColumn` offsets, `invocations[].executionSuccessful`, and `partialFingerprints["targetedMutationId/v1"]`.
|
|
181
|
+
- **Inline suppressions (`# tmt:ignore` / `# pragma: no mutate`):** Add `# tmt:ignore [reason]` or Mutmut-compatible `# pragma: no mutate` on a line intersecting a candidate's AST span or on standalone comment line(s) immediately above its first line. Suppressed gaps record `"suppression"` (`"<reason>"`, `"pragma: no mutate"`, `"inline directive"`, or `"baseline"`), increment `survivor_breakdown.suppressed`, and do not trigger exit code `2`.
|
|
182
|
+
- **Move-resilient IDs:** Candidate IDs hash `(repo_relative_path, enclosing_scope, normalized_ast, occurrence_in_scope, rule, replacement)`, so adding lines or moving an unchanged function within its file preserves `--baseline` and `--shard` assignments.
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Mutation profiles & operator catalogue
|
|
187
|
+
|
|
188
|
+
### Profiles (`--mutators`)
|
|
189
|
+
|
|
190
|
+
| Profile | Shorthand | What runs |
|
|
191
|
+
| --- | --- | --- |
|
|
192
|
+
| **`targeted`** *(default)* | *(none)* | Instruments standalone `<`, `<=`, `>`, `>=`, `==`, `!=` comparisons; evaluates boundary and negation swaps plus observation-synthesized `int`/`float` thresholds and variable-RHS `int` margins. |
|
|
193
|
+
| **`conventional`** | `--conventional` | Runs the static boundary and negation swaps on standalone comparisons without threshold/margin synthesis and without `--deterministic` pruning. |
|
|
194
|
+
| **`full`** | `--full` | Combines `targeted` comparison probes with the complete Python AST source mutation catalogue below (routing standalone comparison edits through probes/overlays when `--deterministic` is active, and non-comparison edits through physical source replays). |
|
|
195
|
+
| **`source-only`** | `--source-only` | Evaluates the complete static AST mutation catalogue exclusively through isolated physical source edits without an instrumented probe baseline. |
|
|
196
|
+
|
|
197
|
+
### Rule catalogue (for reports & `--exclude-rule <RULE>`)
|
|
198
|
+
|
|
199
|
+
| Rule name | Profile | Generated mutations |
|
|
200
|
+
| --- | --- | --- |
|
|
201
|
+
| `comparison-operator` | all | Standalone `<` ↔ `<=`, `>` ↔ `>=`, and negation (`<` ↔ `>=`, `<=` ↔ `>`, `==` ↔ `!=`). `full` and `source-only` add all remaining ordered replacements, `in` ↔ `not in`, `is` ↔ `is not`, and per-operator edits inside chained comparisons (`a < x <= b`). |
|
|
202
|
+
| `comparison-threshold` | `targeted`, `full` | Nearest undistinguished constant-RHS threshold: `n - 1` / `n + 1` for `int`, or adjacent IEEE-754 finite float via `math.nextafter` for `float`. |
|
|
203
|
+
| `comparison-margin` | `targeted`, `full` | Nearest undistinguished variable-RHS integer margin: `a >= (b - 1)` / `a >= (b + 1)` when observed exact integers leave unit slack. |
|
|
204
|
+
| `arithmetic-operator` | `full`, `source-only` | `+` ↔ `-`; `*` → `/`, `//`; `/` → `*`, `//`; `//` → `/`, `*`; `%` → `*`; `**` → `*`; `@` → `*`; `&` / `\|` / `^` swaps; `<<` ↔ `>>`. |
|
|
205
|
+
| `augassign-operator` | `full`, `source-only` | Compound assignments (`+=` ↔ `-=`, `*=` → `/=`, `//=`, `/=` → `*=`, `//=`, `//=` → `/=`, `*=`, `%=` → `*=`, `&=`/`\|=`/`^=`, `<<=` ↔ `>>=`). |
|
|
206
|
+
| `statement-delete` | `full`, `source-only` | Replaces standalone non-docstring expression statements and augmented assignments inside functions, branches, and loops with `pass`. |
|
|
207
|
+
| `rounding-order` | `full`, `source-only` | `(a * b) / c` → `((a / c) * b)`, `((b / c) * a)` (and the same for floor division `//`). |
|
|
208
|
+
| `boolean-operator` | `full`, `source-only` | `and` ↔ `or`. |
|
|
209
|
+
| `boolean-operand` | `full`, `source-only` | Drops each individual operand in an `and` / `or` expression (`a and b` → `a`, `b`). |
|
|
210
|
+
| `unary-operator` | `full`, `source-only` | Removes `not x` → `x` and `~x` → `x`; swaps unary `+x` ↔ `-x`. |
|
|
211
|
+
| `condition-constant` | `full`, `source-only` | Replaces `if` and conditional expression (`a if cond else b`) conditions with `True` and `False`, and `while` conditions with `False`. |
|
|
212
|
+
| `integer-step` | `full`, `source-only` | Replaces `int` literals (excluding `bool`) with `n - 1` and `n + 1`. |
|
|
213
|
+
| `float-step` | `full`, `source-only` | Replaces `float` literals with `x - 1.0` and `x + 1.0`. |
|
|
214
|
+
| `boolean-literal` | `full`, `source-only` | Swaps `True` ↔ `False`. |
|
|
215
|
+
| `string-literal` | `full`, `source-only` | Replaces non-empty `str`/`bytes` literals with `""`/`b""` and empty literals with `"mutated"`/`b"mutated"` (standalone expression docstrings, f-strings, match patterns, and type annotations are excluded). |
|
|
216
|
+
| `return-value` | `full`, `source-only` | Replaces `return expr` values with `None`, `True`, `False`, and `0`. |
|
|
217
|
+
| `call-substitution` | `full`, `source-only` | Swaps calls matching these function or attribute names: `min` ↔ `max`, `all` ↔ `any`, `ceil` ↔ `floor`, `startswith` ↔ `endswith`, `lstrip` ↔ `rstrip`, `find` ↔ `rfind`, `index` ↔ `rindex`. |
|
|
218
|
+
| `git-revert` | `--undo-changes` | Reverts each `SequenceMatcher` diff block in selected modified tracked files back to `--since REV` to detect `UNTESTED CHANGE`. |
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## CLI workflows & option reference
|
|
223
|
+
|
|
224
|
+
### Common recipes
|
|
225
|
+
|
|
226
|
+
```sh
|
|
227
|
+
# Fast local boundary & assertion check with verified pytest suggestions
|
|
228
|
+
tmtpy analyze --deterministic --verify-witnesses
|
|
229
|
+
|
|
230
|
+
# Narrow to specific files, line ranges, test nodes, and extra pytest arguments after --
|
|
231
|
+
tmtpy analyze src/cart.py --lines src/cart.py:10-40 --test tests/test_cart.py -- -k "discount or shipping"
|
|
232
|
+
|
|
233
|
+
# Pull request gate: changed lines + untracked files, change-block reversion, weakened-test check, and SARIF output
|
|
234
|
+
tmtpy analyze --since origin/main --undo-changes --format sarif --output tmt.sarif
|
|
235
|
+
|
|
236
|
+
# Incremental adoption: record current gaps once, then block only new gaps in CI
|
|
237
|
+
tmtpy analyze --deterministic --write-baseline .tmt-baseline.json
|
|
238
|
+
tmtpy analyze --deterministic --baseline .tmt-baseline.json
|
|
239
|
+
|
|
240
|
+
# 4-way CI sharding with per-shard crash-recoverable checkpoint journals
|
|
241
|
+
tmtpy analyze --full --shard 0/4 --checkpoint .tmt-shard-0.jsonl --format jsonl
|
|
242
|
+
tmtpy analyze --full --list --shard 0/4 --format json
|
|
243
|
+
|
|
244
|
+
# Cross-check pruned and overlay verdicts against independent physical source edits
|
|
245
|
+
tmtpy analyze --deterministic --audit
|
|
246
|
+
|
|
247
|
+
# Experimental Linux pytest forkserver (preloads pytest in a guarded broker per worker lane)
|
|
248
|
+
tmtpy analyze --deterministic --runner forkserver -j 4
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Option reference (`tmtpy analyze [options] [paths...] [-- pytest_args...]`)
|
|
252
|
+
|
|
253
|
+
#### Target & Scope
|
|
254
|
+
|
|
255
|
+
| Option | Default | Description |
|
|
256
|
+
| --- | --- | --- |
|
|
257
|
+
| `[paths...]` | `src` if present, else `.` | Python files or directories relative to `--root` (test directories, `conftest.py`, `test_*.py`, `*_test.py`, and symlinks are skipped during directory walks) |
|
|
258
|
+
| `--root <DIR>` | current directory | Target pytest project root |
|
|
259
|
+
| `--lines <PATH:FIRST[-LAST]>` | — | Restrict mutations to specific 1-based line ranges (repeatable; intersects `--since`) |
|
|
260
|
+
| `--since <REV>` | — | Restrict mutations to lines changed since Git `<REV>` plus untracked `.py` files, and check modified conventional test files (`test*/`, `test_*.py`, `*_test.py`, `conftest.py`) for `WEAKENED TEST` |
|
|
261
|
+
| `--undo-changes` | `false` | Also revert diff blocks in selected modified tracked Python files back to `--since` (requires `--since`; newly added or deleted files are not reverted) |
|
|
262
|
+
| `--no-weakened-tests` | `false` | Skip replaying current gaps against test files restored from `--since` |
|
|
263
|
+
| `--exclude <GLOB>` | — | Exclude matching repository-relative source paths from discovery (repeatable) |
|
|
264
|
+
| `--copy-exclude <GLOB>` | — | Exclude matching files or directories when snapshotting the project workspace (repeatable) |
|
|
265
|
+
|
|
266
|
+
#### Profiles & Filtering
|
|
267
|
+
|
|
268
|
+
| Option | Default | Description |
|
|
269
|
+
| --- | --- | --- |
|
|
270
|
+
| `--mutators <PROFILE>` | `targeted` | Select `targeted`, `conventional`, `full`, or `source-only` |
|
|
271
|
+
| `--full` / `--source-only` / `--conventional` | — | Shorthand flags for `--mutators` (mutually exclusive) |
|
|
272
|
+
| `--exclude-rule <RULE>` | — | Exclude a specific rule name from evaluation (repeatable; see rule catalogue above) |
|
|
273
|
+
| `--list` | `false` | List static mutation candidates without running pytest (observation-synthesized thresholds/margins require a live run) |
|
|
274
|
+
|
|
275
|
+
#### Execution, Determinism & Verification
|
|
276
|
+
|
|
277
|
+
| Option | Default | Description |
|
|
278
|
+
| --- | --- | --- |
|
|
279
|
+
| `--test <SELECTOR>` | — | Pytest file path or node ID passed to baseline and mutation trials (repeatable; additional raw pytest flags follow `--`, while witness verification runs its own synthetic test file) |
|
|
280
|
+
| `-j, --jobs <N>` | `1` | Concurrent mutation trial workers |
|
|
281
|
+
| `--timeout <SECONDS>` | adaptive (`max(5s, 5s + 5×baseline)`) | Timeout per pytest process execution |
|
|
282
|
+
| `--runner <spawn\|forkserver>` | `spawn` | Trial process backend (`forkserver` is experimental and supported on Linux only) |
|
|
283
|
+
| `--deterministic` | `false` | Enable observation-based replay pruning for equivalent comparisons and in-memory import overlays |
|
|
284
|
+
| `--verify-survivors` | `false` | Replay comparison edits even when `--deterministic` observations predict survival |
|
|
285
|
+
| `--audit` | `false` | Re-run pruned and overlay verdicts against independent physical source edits and report mismatches as `audit-disagreement` |
|
|
286
|
+
| `--verify-witnesses`, `--suggest-assertions` | `false` | Verify synthesized pytest assertions against both the original snapshot and physical source mutants |
|
|
287
|
+
|
|
288
|
+
#### Output, Baselines, Sharding & Checkpoints
|
|
289
|
+
|
|
290
|
+
| Option | Default | Description |
|
|
291
|
+
| --- | --- | --- |
|
|
292
|
+
| `--format <FMT>` | `text` | Report format: `text`, `json`, `jsonl`, or `sarif` |
|
|
293
|
+
| `--output <FILE>` | `stdout` | Write the rendered report atomically to `<FILE>` |
|
|
294
|
+
| `--show-unreached` | `false` | Include `UNREACHED` edits in `text` output |
|
|
295
|
+
| `--baseline <FILE>` | — | Suppress known finding IDs recorded in `<FILE>` |
|
|
296
|
+
| `--write-baseline <FILE>` | — | Atomically write current gap IDs (excluding inline `# tmt:ignore`) to `<FILE>` when `exit_code != 3` |
|
|
297
|
+
| `--shard <INDEX/COUNT>` | `0/1` | Partition candidate IDs deterministically (`int(id, 16) % COUNT == INDEX`, `0 <= INDEX < COUNT`) |
|
|
298
|
+
| `--checkpoint <FILE>` | — | Lock and resume completed verdicts from an append-only JSONL journal bound to the exact snapshot, interpreter, environment, baseline signature, observations, and edit plan |
|
|
299
|
+
| `-q, --quiet` | `false` | Suppress progress updates and advisory warnings on `stderr` |
|
|
300
|
+
| `--no-config` | `false` | Ignore `[tool.tmt]` defaults in `pyproject.toml` |
|
|
301
|
+
|
|
302
|
+
### Project configuration (`pyproject.toml`)
|
|
303
|
+
|
|
304
|
+
You can store default `analyze` options under `[tool.tmt]` in `<root>/pyproject.toml` (loaded automatically unless `--no-config` is passed; explicit CLI flags always override):
|
|
305
|
+
|
|
306
|
+
```toml
|
|
307
|
+
[tool.tmt]
|
|
308
|
+
paths = ["src"]
|
|
309
|
+
deterministic = true
|
|
310
|
+
jobs = 4
|
|
311
|
+
format = "text"
|
|
312
|
+
exclude_rule = ["return-value"]
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
---
|
|
316
|
+
|
|
317
|
+
## How it works, soundness & limits
|
|
318
|
+
|
|
319
|
+
```mermaid
|
|
320
|
+
flowchart LR
|
|
321
|
+
A["Resolve Scope & AST Sites<br/>(move-resilient IDs)"] --> B["Pytest Baseline Gate<br/>(ordinary + probe when applicable)"]
|
|
322
|
+
B --> C["Summarize Exact Scalars<br/>(int deltas, float extrema, 3-bit classes)"]
|
|
323
|
+
C --> D["Plan Edits<br/>(operators, thresholds, margins, AST rules)"]
|
|
324
|
+
D -->|"--deterministic & same"| E["INPUT GAP [observed]<br/>(0 replays)"]
|
|
325
|
+
D -->|"--deterministic probe edit"| F["Import Overlay Replay<br/>(+ audit-hook fallback)"]
|
|
326
|
+
D -->|"default / non-probe AST / --source-only"| G["Physical Source Replay<br/>(opcode/line activation trace)"]
|
|
327
|
+
F --> H["KILLED / GAP / Witness Check"]
|
|
328
|
+
G --> H
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### Execution & soundness guarantees
|
|
332
|
+
|
|
333
|
+
1. **Baseline parity gate.** Before running any mutation, `tmtpy` runs an ordinary `pytest` baseline in a clean snapshot. Whenever comparison probes are selected (`targeted`, `conventional`, or `full` with comparison sites), it runs a second instrumented `pytest` baseline and verifies identical collected node lists, execution order, and per-phase outcomes.
|
|
334
|
+
2. **In-frame operand observation.** Standalone comparisons stay in their original Python stack frame so operand evaluation order, short-circuiting, and `sys._getframe` callers remain intact. Constant-RHS scalar comparisons use a single callback (`constant_rhs`); dynamic comparisons pair frame-keyed `left` and `right` callbacks. Only exact `int` (excluding `bool`), finite `float`, and bounded `str`/`bytes` (`<= 4096` units) are summarized; custom types, subclasses, mixed scalar types, `NaN`, `±inf`, or interrupted evaluations mark the site `unknown` and disable proof-based pruning.
|
|
335
|
+
3. **Interval & 3-bit mask algebra.** Observed `int` differences (`left - right`) directly yield the closed interval of equivalent thresholds or variable-RHS margins in a constant number of arithmetic operations regardless of interval width, supporting arbitrary-precision Python integers. Unshifted operator replacements are decided by a 3-bit `(less, equal, greater)` mask proven equivalent to pairwise evaluation in [Observation.lean](verification/lean/Observation.lean).
|
|
336
|
+
4. **Causally gated `killed` verdicts.** Physical source replays track bytecode instruction offsets (`f_trace_opcodes`) for expressions and line events for diff reverts; import overlays wrap replaced expressions with an activation tap. A failing trial is classified as `killed` only if pytest exited with test failures, execution followed the baseline prefix, and a test failed after activating the mutated site—preventing broken imports or unrelated flaky tests from masquerading as killed mutants.
|
|
337
|
+
5. **Isolated snapshots & process-group cleanup.** The snapshot excludes `.git`, `.venv`, caches, `dist`/`build`, `node_modules`, and external symlinks (rewriting internal absolute symlinks into snapshot-relative links). Per-trial copies try native `copyfile(3)` (`COPYFILE_CLONE`) on macOS and `cp -a --reflink=auto` on Linux before falling back to `cp` / `shutil.copytree`, and workers run in dedicated sessions (`start_new_session=True`) waited via `kqueue`/`pidfd` (with `subprocess.wait` fallback) and cleaned up with `SIGKILL` to the process group.
|
|
338
|
+
6. **Guarded Linux forkserver (`--runner forkserver`).** On Linux, an opt-in broker preloads `pytest` once per worker lane and forks isolated trial processes while keeping fresh subprocesses for baselines and `--audit`. During startup and warm-baseline validation, custom startup hooks (`sitecustomize`, `usercustomize`, or executable `.pth` imports other than standard setuptools `distutils-precedence.pth`), module shadowing, or baseline mismatches fall back to `spawn` with a diagnostic on `stderr`; broker failures after dispatching a trial surface as incomplete evidence rather than risking duplicate execution (see [docs/design/forkserver.md](docs/design/forkserver.md)).
|
|
339
|
+
|
|
340
|
+
### Assumptions & known limits
|
|
341
|
+
|
|
342
|
+
- **Determinism contract:** `--deterministic` assumes repeatable test collection, execution order, operand values, and side effects. Nondeterministic suites should stick to the default physical mode or pair `--deterministic` with `--verify-survivors` / `--audit`.
|
|
343
|
+
- **Serial pytest inside workers:** Run pytest in its standard serial mode inside each trial (do not pass `pytest-xdist` `-n` flags); scale horizontally with `tmtpy analyze -j <N>` or `tmtpy analyze --shard <INDEX/COUNT>`.
|
|
344
|
+
- **Tracing & loader boundaries:** Child subprocesses, C extensions, custom import loaders, or pytest plugins that replace `sys.settrace` (such as coverage tracers) can prevent activation or observation tracking; detected subprocess spawns and observed-file loader bypasses disable pruning, while lost trace hooks surface as incomplete evidence (exit `3`).
|
|
345
|
+
- **Witness synthesis scope:** Concrete `[verified]` assertions cover both direct comparison-returning functions (for `INPUT GAP` and `ASSERTION GAP`) and in-place assertion strengthening for bare calls in existing tests (including class methods, multi-line functions, and `SOURCE SURVIVOR` gaps). Reported distinguishing operands are algebraic comparison witnesses that may still be constrained by higher-level callers.
|
|
346
|
+
- **External side effects:** Relative file writes stay inside each disposable trial copy, whereas tests writing to hardcoded absolute paths or external network services carry the same side effects as running `pytest` directly.
|
|
347
|
+
|
|
348
|
+
### Benchmarks
|
|
349
|
+
|
|
350
|
+
[benchmarks/README.md](benchmarks/README.md) documents reproducible serial comparisons against **Mutmut 3.8.1**, **pytest-gremlins 1.15.0**, and **Cosmic Ray 8.9.0** on CPython 3.12 / pytest 9.2 (confirming verdict parity on matched conventional edits while inferring additional threshold survivors without replay), alongside paired measurements for native CoW/wait/probe optimizations (23–28% campaign wall-time reduction; [docs/design/performance.md](docs/design/performance.md)) and the Linux forkserver (26–27% reduction in an isolated Linux guest).
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
## Development & formal verification
|
|
355
|
+
|
|
356
|
+
```sh
|
|
357
|
+
python -m pip install -e . ruff
|
|
358
|
+
python -m pytest
|
|
359
|
+
ruff check .
|
|
360
|
+
|
|
361
|
+
# Combinatorial PICT seed checks (5 models under verification/pict/)
|
|
362
|
+
for model in campaign copy-paths fast-paths forkserver probe-paths; do
|
|
363
|
+
pict "verification/pict/${model}.pict" "/e:verification/pict/${model}.seed.tsv" > "/tmp/${model}.tsv"
|
|
364
|
+
python3 scripts/pict-check "/tmp/${model}.tsv" "verification/pict/${model}.seed.tsv"
|
|
365
|
+
done
|
|
366
|
+
|
|
367
|
+
# TLA+ / TLC protocol verification (baseline gating, worker waits, and forkserver ownership)
|
|
368
|
+
for model in Campaign WorkerWait ForkServer; do
|
|
369
|
+
tla2tools -workers 1 -config "verification/tla/${model}.cfg" "verification/tla/${model}.tla"
|
|
370
|
+
done
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
Design notes:
|
|
374
|
+
- [Core architecture & execution model](docs/design/targeted-mutation-python.md)
|
|
375
|
+
- [Replay & observation performance](docs/design/performance.md)
|
|
376
|
+
- [Linux pytest forkserver protocol](docs/design/forkserver.md)
|
|
377
|
+
- [Lean 4 order-class & boundary proofs](verification/lean/Observation.lean)
|
|
378
|
+
|
|
379
|
+
## Related implementations & prior work
|
|
380
|
+
|
|
381
|
+
`targeted-mutation-python` is the Python sibling of:
|
|
382
|
+
- **Rust (`cargo tmt`):** [github.com/t-k/targeted-mutation](https://github.com/t-k/targeted-mutation)
|
|
383
|
+
- **JavaScript / TypeScript (`targeted-mutation`):** [github.com/t-k/targeted-mutation-ts](https://github.com/t-k/targeted-mutation-ts)
|
|
384
|
+
- **Go (`targeted-mutation-go`):** [github.com/t-k/targeted-mutation-go](https://github.com/t-k/targeted-mutation-go)
|
|
385
|
+
|
|
386
|
+
Generating mutants from runtime test observations is known in the literature as *test-aware mutant generation*, alongside related lines of work such as SEMu (symbolic execution to kill surviving mutants), DSpot (assertion amplification), the W-method (distinguishing sequences for finite state machines), and Meta's ACH. Like its Rust, TypeScript, and Go siblings, `targeted-mutation-python` occupies the **SMT-solver-free, AI-free** corner of that design space: record compact runtime extrema and solve undistinguished intervals directly.
|
|
387
|
+
|
|
388
|
+
## License
|
|
389
|
+
|
|
390
|
+
Licensed under the [Apache License, Version 2.0](LICENSE).
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
targeted_mutation_python/__init__.py,sha256=n-msT8AdlERr-i7b9CFSDuaGgp32GElOYM6_pdXMwaA,54
|
|
2
|
+
targeted_mutation_python/__main__.py,sha256=k1ocEWawweo1qCJWNFAAvyxz3tcY13dzvCenHszij30,48
|
|
3
|
+
targeted_mutation_python/campaign.py,sha256=2AkzVp9g8mi4JGuDWorXB8NyXgkPYTiHaVyR1NU42gw,32470
|
|
4
|
+
targeted_mutation_python/checkpoint.py,sha256=v5faN9FXq1Yr3VdNvjyd54O9R5Y_IJRu04OUveK7Ji0,6039
|
|
5
|
+
targeted_mutation_python/cli.py,sha256=SPRF-V7Xtun_OAN4RRXdsbBMkBsjw99pXJpwRq-f9-s,16190
|
|
6
|
+
targeted_mutation_python/discovery.py,sha256=f5PAYs9ciEcIlsn9O4-i25CH4VZDz4ZVnr3B6VkS-gk,20096
|
|
7
|
+
targeted_mutation_python/forkserver.py,sha256=s7RpVB6ZkT7ppVOxNes0RFerhZ3W6qy-9V6tGuwBDmg,13279
|
|
8
|
+
targeted_mutation_python/model.py,sha256=ttFRPJTEMNhWTSFtIwWwXae8OhObJMrvpYu4M90_0_E,7807
|
|
9
|
+
targeted_mutation_python/report.py,sha256=n8Q_i60TiWZBuIq8THUkOjRduJ5RcgcXXkdd5n3wSeE,8162
|
|
10
|
+
targeted_mutation_python/revert.py,sha256=1T8cFyiZXmag0AQsFSYipXyHg-_N_-n8OdCcAfiDaiY,2383
|
|
11
|
+
targeted_mutation_python/runner.py,sha256=-0nrzJy7ypzIEvlNIAtljDN8D9kdnoMv-ucMzc6DSr4,18156
|
|
12
|
+
targeted_mutation_python/scope.py,sha256=TPDHp7lSE5rVrsZDw2tKPYjOxudC8tbEvjAfdRF7Xoc,8061
|
|
13
|
+
targeted_mutation_python/witness.py,sha256=CJP8F6GZBVH_RMLMZiaZhYbAteEw-tEYso_JiAshIic,10780
|
|
14
|
+
targeted_mutation_python/worker.py,sha256=SmfmAzpVkM163bLpRgEyuhGS-sQMdZoay1jMzaVaG64,30052
|
|
15
|
+
targeted_mutation_python/workspace.py,sha256=9HBWjXzzvVnWpQA2ZMa4bG2QssTsxxYCEZR3lcvKYPE,3707
|
|
16
|
+
targeted_mutation-0.1.0.dist-info/METADATA,sha256=5W1UHaLl8dEWJwNE_se0Ip97zZ0IDpgZP7A5iPmN1gs,33066
|
|
17
|
+
targeted_mutation-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
18
|
+
targeted_mutation-0.1.0.dist-info/entry_points.txt,sha256=Jm05_7PHxBYpLUum-RfqcRJhX9wG2F-pD1BR4cyp6uk,175
|
|
19
|
+
targeted_mutation-0.1.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
20
|
+
targeted_mutation-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Observation-guided mutation testing for Python."""
|