Metadata-Version: 2.4
Name: pytest-spark-mutation-testing
Version: 1.0.0
Summary: Semantic mutation testing for PySpark pipelines - a pytest plugin that mutates Catalyst plans and scores your suite
Author: Punit Walawalkar
License: Apache-2.0
Project-URL: Homepage, https://github.com/wpunit13/spark-mutation-testing
Project-URL: Repository, https://github.com/wpunit13/spark-mutation-testing
Project-URL: Documentation, https://github.com/wpunit13/spark-mutation-testing/tree/main/docs
Project-URL: Issues, https://github.com/wpunit13/spark-mutation-testing/issues
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: Pytest
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: pyspark<4.3,>=3.5
Requires-Dist: py4j>=0.10.9
Requires-Dist: tomli; python_version < "3.11"
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"

# pytest-spark-mutation-testing

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.

## 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).
