Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 47 additions & 2 deletions python/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,50 @@
# pytest-spark-mutation-testing

Pytest plugin: semantic mutation testing for PySpark pipelines.
Semantic mutation testing for **PySpark** pipelines — a pytest plugin that
mutates Catalyst plans (joins, filters, aggregates, windows, projections) and
scores whether your test suite catches them.

See the [repository](https://github.com/wpunit13/spark-mutation-testing) for the full documentation.
## Install

```bash
pip install pytest-spark-mutation-testing
```

Requires Python 3.9+ and PySpark 3.5.x or 4.2.x (4.2 is Scala 2.13-only).

## Quick start

```bash
cd your-pipeline
pytest --spark-mutate
```

The plugin runs your suite once unmutated (baseline), discovers every
mutation site in the analyzed plans, then re-runs only the affected tests per
mutant — fail-fast — and writes:

- `mutation-report.{json,sarif,html}` — per-mutant verdicts (`KILLED` /
`SURVIVED` / `TIMED_OUT` / `NOT_APPLIED` / `ERRORED`) and the mutation score
- `test-value-report.{json,html}` — per-test kill attribution that flags
redundant test cases

Optional config in your `pyproject.toml`:

```toml
[tool.spark-mutator]
target_modules = ["my_pipeline.transforms"] # scope discovery
excluded_mutators = ["CrossJoinMutator"] # skip a rule
timeout_multiplier = 2.0 # per-mutant deadline
min_mutation_score = 80.0 # CI gate
```

## Documentation

- [Full developer guide](https://github.com/wpunit13/spark-mutation-testing/tree/main/docs)
- [PySpark quick start](https://github.com/wpunit13/spark-mutation-testing#quick-start)
- Runnable proof: [`examples/pyspark-pipeline/`](https://github.com/wpunit13/spark-mutation-testing/tree/main/examples/pyspark-pipeline)
(weak suite ⇒ mutants survive; hardened suite ⇒ mutants killed)

## License

Apache-2.0 — see [LICENSE](https://github.com/wpunit13/spark-mutation-testing/blob/main/LICENSE).
1 change: 1 addition & 0 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ dependencies = [
[project.urls]
Homepage = "https://github.com/wpunit13/spark-mutation-testing"
Repository = "https://github.com/wpunit13/spark-mutation-testing"
Documentation = "https://github.com/wpunit13/spark-mutation-testing/tree/main/docs"
Issues = "https://github.com/wpunit13/spark-mutation-testing/issues"

[project.optional-dependencies]
Expand Down
Loading