Mutmut – Python Mutation Tester

https://news.ycombinator.com/rss Hits: 2
Summary

mutmut - python mutation tester Mutmut is a mutation testing system for Python, with a strong focus on ease of use. If you don't know what mutation testing is try starting with this article. Some highlight features: Found mutants can be applied on disk with a simple command making it very easy to work with the results Remembers work that has been done, so you can work incrementally Knows which tests to execute, speeding up mutation testing Interactive terminal based UI Parallel and fast execution If you want to mutate code outside of functions, you can try using mutmut 2, which has a different execution model than mutmut 3+. Requirements Mutmut must be run on a system with fork support. This means that if you want to run on windows, you must run inside WSL. Install and run You can get started with a simple: pip install mutmut mutmut run This will by run pytest on tests in the "tests" or "test" folder and it will try to figure out where the code to mutate is. You can stop the mutation run at any time and mutmut will restart where you left off. It will continue where it left off, and re-test functions that were modified since last run. To work with the results, use mutmut browse where you can see the mutants, retest them when you've updated your tests. You can also write a mutant to disk from the browse interface, or via mutmut apply <mutant>. You should REALLY have the file you mutate under source code control and committed before you apply a mutant! Configuration In setup.cfg in the root of your project you can configure mutmut if you need to: [mutmut] paths_to_mutate =src/ tests_dir =tests/ If you use pyproject.toml, you must specify the paths as array in a tool.mutmut section: [ tool . mutmut ] paths_to_mutate = [ " src/ " ] tests_dir = [ " tests/ " ] See below for more options for configuring mutmut. Wildcards for testing mutants Unix filename pattern matching style on mutants is supported. Example: mutmut run "my_module*" mutmut run "my_module.my_function*" In t...

First seen: 2025-05-26 19:49

Last seen: 2025-05-26 21:53