boxed / mutmut

Mutation testing system
https://mutmut.readthedocs.io
BSD 3-Clause "New" or "Revised" License
902 stars 109 forks source link

Add support for `--test-file` to mimic `--test-dir` but for specific files. #326

Closed EdgyEdgemond closed 3 months ago

EdgyEdgemond commented 3 months ago

I have some large code bases that would be nice to try mutmut on, but as the test runs aren't quick, running them for all mutations is prohibitive. I can limit the tests down to a subset, but where I have a one to one mapping test_module.py and module.py it would be nice to be able to run

mutmut run --paths-to-mutate src/module.py --test-file tests/test_module.py

Apologies if this is somehow possible, but trying to point test-dir at a specific file still appears to run all tests.

EdgyEdgemond commented 3 months ago

This is already biting on test suites that take 10-15 seconds, testing 100+ mutations is painful.

On other code bases with test suites in the minute range and any number of mutations its just not viable to run.

boxed commented 3 months ago

You can specify the full command line in the runner flag. I recently did this for my own work code base:

setup.cfg:

[mutmut]
paths_to_mutate=dryft/planning/scheduling.py
runner=python -m pytest dryft/planning/scheduling__tests.py
EdgyEdgemond commented 3 months ago

Solves my problem.