mutmut 2.5.1__tar.gz → 3.0.1__tar.gz

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.
Files changed (35) hide show
  1. mutmut-3.0.1/AUTHORS.rst +22 -0
  2. {mutmut-2.5.1 → mutmut-3.0.1}/HISTORY.rst +6 -113
  3. {mutmut-2.5.1 → mutmut-3.0.1}/MANIFEST.in +1 -0
  4. mutmut-3.0.1/PKG-INFO +206 -0
  5. mutmut-3.0.1/README.rst +178 -0
  6. mutmut-3.0.1/mutmut/__init__.py +308 -0
  7. mutmut-3.0.1/mutmut/__main__.py +1500 -0
  8. mutmut-3.0.1/mutmut/result_browser_layout.tcss +26 -0
  9. mutmut-3.0.1/mutmut.egg-info/PKG-INFO +206 -0
  10. {mutmut-2.5.1 → mutmut-3.0.1}/mutmut.egg-info/SOURCES.txt +4 -5
  11. {mutmut-2.5.1 → mutmut-3.0.1}/mutmut.egg-info/requires.txt +2 -5
  12. mutmut-3.0.1/requirements.txt +4 -0
  13. {mutmut-2.5.1 → mutmut-3.0.1}/setup.cfg +1 -10
  14. {mutmut-2.5.1 → mutmut-3.0.1}/setup.py +4 -7
  15. {mutmut-2.5.1 → mutmut-3.0.1}/test_requirements.txt +0 -2
  16. mutmut-3.0.1/tests/test_mutation.py +339 -0
  17. mutmut-3.0.1/tests/test_mutmut3.py +80 -0
  18. mutmut-2.5.1/AUTHORS.rst +0 -42
  19. mutmut-2.5.1/PKG-INFO +0 -422
  20. mutmut-2.5.1/README.rst +0 -390
  21. mutmut-2.5.1/mutmut/__init__.py +0 -1336
  22. mutmut-2.5.1/mutmut/__main__.py +0 -542
  23. mutmut-2.5.1/mutmut/cache.py +0 -528
  24. mutmut-2.5.1/mutmut.egg-info/PKG-INFO +0 -422
  25. mutmut-2.5.1/requirements.txt +0 -6
  26. mutmut-2.5.1/tests/test_cache.py +0 -40
  27. mutmut-2.5.1/tests/test_init.py +0 -196
  28. mutmut-2.5.1/tests/test_main.py +0 -720
  29. mutmut-2.5.1/tests/test_mutation.py +0 -393
  30. mutmut-2.5.1/tests/test_mutmut_config_hooks.py +0 -61
  31. {mutmut-2.5.1 → mutmut-3.0.1}/LICENSE +0 -0
  32. {mutmut-2.5.1 → mutmut-3.0.1}/mutmut.egg-info/dependency_links.txt +0 -0
  33. {mutmut-2.5.1 → mutmut-3.0.1}/mutmut.egg-info/entry_points.txt +0 -0
  34. {mutmut-2.5.1 → mutmut-3.0.1}/mutmut.egg-info/not-zip-safe +0 -0
  35. {mutmut-2.5.1 → mutmut-3.0.1}/mutmut.egg-info/top_level.txt +0 -0
@@ -0,0 +1,22 @@
1
+ =======
2
+ Credits
3
+ =======
4
+
5
+ * Anders Hovmöller <boxed@killingar.net>
6
+ * Felipe Pontes <felipemfpontes@gmail.com>
7
+ * William Orr <will@worrbase.com>
8
+ * Trevin Gandhi <trevin.gandhi@petuum.com>
9
+ * Daniel Hahler <git@thequod.de>
10
+ * Marcelo Da Cruz Pinto
11
+ * Jakub Stolarski
12
+ * Hristo Georgiev
13
+ * Savo Kovačević <savo.s.kovacevic@gmail.com>
14
+ * Nathan Klapstein <nklapste@ualberta.ca>
15
+ * Brian Skinn <brian.skinn@gmail.com>
16
+ * Jim Jazwiecki <jim.jazwiecki@gmail.com>
17
+ * neroks <gneroks@gmail.com>
18
+ * John Vandenberg <jayvdb@gmail.com>
19
+ * Luca Simonetto <luca.simonetto.94@gmail.com>
20
+ * Emil Stenström <emil@emilstenstrom.se>
21
+ * Roxane Bellott <roxane.bellot@gmail.com>
22
+ * Tomáš Chvátal <tchvatal@suse.com>
@@ -1,127 +1,20 @@
1
1
  Changelog
2
2
  ---------
3
3
 
4
- 2.5.1
4
+ 3.0.1
5
5
  ~~~~~
6
6
 
7
- * Python 3.12 compatibility improved
7
+ * Missed a file in distribution, so `browse` command was broken.
8
8
 
9
- 2.5.0
9
+ 3.0.0
10
10
  ~~~~~
11
11
 
12
- * Add cli option to specify html report directory
12
+ * Execution model switched to mutation schemata, which enabled parallell execution.
13
13
 
14
- * Fix use patch file under Windows
14
+ * New terminal UI
15
15
 
16
- * Improve documentation about cache issues
16
+ * Pytest only, which enabled better integration, cutting execution time significantly.
17
17
 
18
- 2.4.5
19
- ~~~~~
20
-
21
- * Add skipped column in html index report
22
-
23
- * Untested/skipped in show all does not show skipped
24
-
25
- * mutmut should pick up the config before running the original tests. That allows to specify test suits you want to run
26
-
27
- * improved some high-level help text & documentation
28
-
29
- 2.4.4
30
- ~~~~~
31
-
32
- * Fix issue with `TypeError` for empty file diffs
33
-
34
- * Introduce mutation of f-strings
35
-
36
- * Allow newer versions of junit-xml
37
-
38
- 2.4.3
39
- ~~~~~
40
-
41
- * Fix for a big where worker cycling would just hang mutmut (thanks Jan Królikowski!)
42
-
43
- * Added `--CI` flag
44
-
45
-
46
-
47
- 2.4.2
48
- ~~~~~
49
-
50
- * Fix bug with init db on wrong function (thanks Samuel Razzell)
51
-
52
- * Fixed junitxml line number, daemon warning, and missing argument in unit test (thanks Samuel Razzell)
53
-
54
-
55
- 2.4.1
56
- ~~~~~
57
-
58
- * Support paths with path separators
59
-
60
- * Disable spinner in no-progress mode
61
-
62
- 2.4.0
63
- ~~~~~
64
-
65
- * Add pyproject support (thanks sed-i)
66
-
67
- * Change very small or very large numbers (floats) by a relative amount (thanks Peter Hill)
68
-
69
- This avoids (some) problems with unkillable mutants, for example:
70
-
71
- 1e16 -> 1e+16
72
-
73
- which now becomes
74
-
75
- 1e16 -> 2e+16
76
-
77
- * Fix inconsistent output of `mutmut show` after using `--enable-mutation-types` (thanks Andreas Finkler)
78
-
79
- * Improve test selection through ``pre_mutation(context)`` (thanks Andreas Finkler)
80
-
81
- * Remove `--cache-only` option and second argument to `mutmut show` (thanks Andreas Finkler)
82
-
83
-
84
- 2.3.0
85
- ~~~~~
86
-
87
- * Add `--disable-mutation-types` and `--enable-mutation-types` to control what types of mutations are performed
88
-
89
- * Fixed error where ``mutmut_config.init()`` was not called when running without explicitly having set ``PYTHONPATH``
90
-
91
- * Use ``Click``'s subcommand feature to refactor the command line interface. For the end user, this can now run ``mutmut [COMMAND] -h``
92
- to check which parameters are relevant to this specific subcommand. The change is backwards compatible, and all existing commands
93
- work the same as before, with the exception of ``mutmut --version``, which now has to be ``mutmut version``.
94
-
95
- * You can now set the ``context.config.test_command`` in the ``mutmut_config.pre_mutation(context)`` hook to select the relevant subset of tests.
96
- Coverage contexts are now accessible in ``config.coverage_data`` to help with the selection.
97
-
98
- 2.2.0
99
- ~~~~~
100
-
101
- * Add ability to update progress output only after test passes (`--no-progress`)
102
-
103
- * Added option `--simple-output` to disable usage of emojis in output
104
-
105
- * Fixed the total mutants and killed column in html report (#184)
106
-
107
- * Fixed paths_to_exclude config parsing
108
-
109
- * Stricter error code check for test runners. The previous check sometimes counted no tests as a killed mutant
110
-
111
- * Misc fixes
112
-
113
- 2.1.0
114
- ~~~~~
115
-
116
- * Support unittest, so you don't need pytest anymore
117
-
118
- * Fixed a bug where Ctrl+C wouldn't exit mutmut
119
-
120
- * Support for Coverage 5
121
-
122
- * Skip mutating test files if they are in the same source tree as the main code
123
-
124
- * Advanced whitelisting: More advanced AST level callback
125
18
 
126
19
  2.0.0
127
20
  ~~~~~
@@ -3,3 +3,4 @@ include LICENSE
3
3
  include README.rst
4
4
  include requirements.txt
5
5
  include test_requirements.txt
6
+ include mutmut/result_browser_layout.tcss
mutmut-3.0.1/PKG-INFO ADDED
@@ -0,0 +1,206 @@
1
+ Metadata-Version: 2.1
2
+ Name: mutmut
3
+ Version: 3.0.1
4
+ Summary: mutation testing for Python 3
5
+ Home-page: https://github.com/boxed/mutmut
6
+ Author: Anders Hovmöller
7
+ Author-email: boxed@killingar.net
8
+ License: BSD
9
+ Keywords: mutmut mutant mutation test testing
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: BSD License
13
+ Classifier: Natural Language :: English
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.7
16
+ License-File: LICENSE
17
+ License-File: AUTHORS.rst
18
+ Requires-Dist: parso
19
+ Requires-Dist: click
20
+ Requires-Dist: junit-xml==1.8
21
+ Requires-Dist: setproctitle
22
+ Provides-Extra: pytest
23
+ Requires-Dist: pytest; extra == "pytest"
24
+ Provides-Extra: coverage
25
+ Requires-Dist: coverage; extra == "coverage"
26
+ Provides-Extra: patch
27
+ Requires-Dist: whatthepatch==0.0.6; extra == "patch"
28
+
29
+ mutmut - python mutation tester
30
+ ===============================
31
+
32
+ .. image:: https://github.com/boxed/mutmut/actions/workflows/tests.yml/badge.svg
33
+ :target: https://github.com/boxed/mutmut/actions/workflows/tests.yml
34
+
35
+ .. image:: https://readthedocs.org/projects/mutmut/badge/?version=latest
36
+ :target: https://mutmut.readthedocs.io/en/latest/?badge=latest
37
+ :alt: Documentation Status
38
+
39
+
40
+ Mutmut is a mutation testing system for Python, with a strong focus on ease
41
+ of use. If you don't know what mutation testing is try starting with
42
+ `this article <https://kodare.net/2016/12/01/mutmut-a-python-mutation-testing-system.html>`_.
43
+
44
+ Some highlight features:
45
+
46
+ - Found mutants can be applied on disk with a simple command making it very
47
+ easy to work with the results
48
+ - Remembers work that has been done, so you can work incrementally
49
+ - Knows which tests to execute, speeding up mutation testing
50
+ - Interactive terminal based UI
51
+ - Parallel and fast execution
52
+
53
+ .. image:: browse_screenshot.png
54
+
55
+
56
+ If you want to mutate code outside of functions, you can try using mutmut 2,
57
+ which has a different execution model than mutmut 3+.
58
+
59
+
60
+ Requirements
61
+ ------------
62
+
63
+ Mutmut must be run on a system with `fork` support. This means that if you want
64
+ to run on windows, you must run inside WSL.
65
+
66
+
67
+
68
+ Install and run
69
+ ---------------
70
+
71
+ You can get started with a simple:
72
+
73
+ .. code-block:: console
74
+
75
+ pip install mutmut
76
+ mutmut run
77
+
78
+ This will by run pytest on tests in the "tests" or "test" folder and
79
+ it will try to figure out where the code to mutate is.
80
+
81
+
82
+
83
+ .. code-block:: ini
84
+
85
+ [mutmut]
86
+ paths_to_mutate=src/
87
+ tests_dir=tests/
88
+
89
+ You can stop the mutation run at any time and mutmut will restart where you
90
+ left off. It will continue where it left off, and re-test functions that were
91
+ modified since last run.
92
+
93
+ To work with the results, use `mutmut browse` where you can see the mutants,
94
+ retest them when you've updated your tests.
95
+
96
+ You can also write a mutant to disk from the `browse` interface, or via
97
+ `mutmut apply <mutant>`. You should **REALLY** have the file you mutate under
98
+ source code control and committed before you apply a mutant!
99
+
100
+
101
+ Wildcards for testing mutants
102
+ -----------------------------
103
+
104
+ Unix filename pattern matching style on mutants is supported. Example:
105
+
106
+ .. code-block:: console
107
+
108
+ mutmut run "my_module*"
109
+ mutmut run "my_module.my_function*"
110
+
111
+ In the `browse` TUI you can press `f` to retest a function, and `m` to retest
112
+ an entire module.
113
+
114
+
115
+ "also copy" files
116
+ -----------------
117
+
118
+ To run the full test suite some files are often needed above the tests and the
119
+ source. You can configure to copy extra files that you need by adding
120
+ directories and files to `also_copy` in your `setup.cfg`:
121
+
122
+ .. code-block:: ini
123
+
124
+ also_copy=
125
+ iommi/snapshots/
126
+ conftest.py
127
+
128
+
129
+ Limit stack depth
130
+ -----------------
131
+
132
+ In big code bases some functions are called incidentally by huge swaths of the
133
+ codebase, but you really don't want tests that hit those executions to count
134
+ for mutation testing purposes. Incidentally tested functions lead to slow
135
+ mutation testing as hundreds of tests can be checked for things that should
136
+ have clean and fast unit tests, and it leads to bad test suites as any
137
+ introduced bug in those base functions will lead to many tests that fail which
138
+ are hard to understand how they relate to the function with the change.
139
+
140
+ You can configure mutmut to only count a test as being relevant for a function
141
+ if the stack depth from the test to the function is below some limit. In your
142
+ `setup.cfg` add:
143
+
144
+ .. code-block:: ini
145
+
146
+ max_stack_depth=8
147
+
148
+ A lower value will increase mutation speed and lead to more localized tests,
149
+ but will also lead to more surviving mutants that would otherwise have been
150
+ caught.
151
+
152
+
153
+ Exclude files from mutation
154
+ ---------------------------
155
+
156
+ You can exclude files from mutation in `setup.cfg`:
157
+
158
+ .. code-block::
159
+
160
+ do_not_mutate=
161
+ *__tests.py
162
+
163
+
164
+ Whitelisting
165
+ ------------
166
+
167
+ You can mark lines like this:
168
+
169
+ .. code-block:: python
170
+
171
+ some_code_here() # pragma: no mutate
172
+
173
+ to stop mutation on those lines. Some cases we've found where you need to
174
+ whitelist lines are:
175
+
176
+ - The version string on your library. You really shouldn't have a test for this :P
177
+ - Optimizing break instead of continue. The code runs fine when mutating break
178
+ to continue, but it's slower.
179
+
180
+
181
+ Example mutations
182
+ -----------------
183
+
184
+ - Integer literals are changed by adding 1. So 0 becomes 1, 5 becomes 6, etc.
185
+ - `<` is changed to `<=`
186
+ - break is changed to continue and vice versa
187
+
188
+ In general the idea is that the mutations should be as subtle as possible.
189
+ See `__init__.py` for the full list.
190
+
191
+
192
+ Workflow
193
+ --------
194
+
195
+ This section describes how to work with mutmut to enhance your test suite.
196
+
197
+ 1. Run mutmut with `mutmut run`. A full run is preferred but if you're just
198
+ getting started you can exit in the middle and start working with what you
199
+ have found so far.
200
+ 2. Show the mutants with `mutmut browse`
201
+ 3. Find a mutant you want to work on and write a test to try to kill it.
202
+ 4. Press `r` to rerun the mutant and see if you successfully managed to kill it.
203
+
204
+ Mutmut keeps the data of what it has done and the mutants in the `mutants/`
205
+ directory.If you want to make sure you run a full mutmut run you can delete
206
+ this directory to start from scratch.
@@ -0,0 +1,178 @@
1
+ mutmut - python mutation tester
2
+ ===============================
3
+
4
+ .. image:: https://github.com/boxed/mutmut/actions/workflows/tests.yml/badge.svg
5
+ :target: https://github.com/boxed/mutmut/actions/workflows/tests.yml
6
+
7
+ .. image:: https://readthedocs.org/projects/mutmut/badge/?version=latest
8
+ :target: https://mutmut.readthedocs.io/en/latest/?badge=latest
9
+ :alt: Documentation Status
10
+
11
+
12
+ Mutmut is a mutation testing system for Python, with a strong focus on ease
13
+ of use. If you don't know what mutation testing is try starting with
14
+ `this article <https://kodare.net/2016/12/01/mutmut-a-python-mutation-testing-system.html>`_.
15
+
16
+ Some highlight features:
17
+
18
+ - Found mutants can be applied on disk with a simple command making it very
19
+ easy to work with the results
20
+ - Remembers work that has been done, so you can work incrementally
21
+ - Knows which tests to execute, speeding up mutation testing
22
+ - Interactive terminal based UI
23
+ - Parallel and fast execution
24
+
25
+ .. image:: browse_screenshot.png
26
+
27
+
28
+ If you want to mutate code outside of functions, you can try using mutmut 2,
29
+ which has a different execution model than mutmut 3+.
30
+
31
+
32
+ Requirements
33
+ ------------
34
+
35
+ Mutmut must be run on a system with `fork` support. This means that if you want
36
+ to run on windows, you must run inside WSL.
37
+
38
+
39
+
40
+ Install and run
41
+ ---------------
42
+
43
+ You can get started with a simple:
44
+
45
+ .. code-block:: console
46
+
47
+ pip install mutmut
48
+ mutmut run
49
+
50
+ This will by run pytest on tests in the "tests" or "test" folder and
51
+ it will try to figure out where the code to mutate is.
52
+
53
+
54
+
55
+ .. code-block:: ini
56
+
57
+ [mutmut]
58
+ paths_to_mutate=src/
59
+ tests_dir=tests/
60
+
61
+ You can stop the mutation run at any time and mutmut will restart where you
62
+ left off. It will continue where it left off, and re-test functions that were
63
+ modified since last run.
64
+
65
+ To work with the results, use `mutmut browse` where you can see the mutants,
66
+ retest them when you've updated your tests.
67
+
68
+ You can also write a mutant to disk from the `browse` interface, or via
69
+ `mutmut apply <mutant>`. You should **REALLY** have the file you mutate under
70
+ source code control and committed before you apply a mutant!
71
+
72
+
73
+ Wildcards for testing mutants
74
+ -----------------------------
75
+
76
+ Unix filename pattern matching style on mutants is supported. Example:
77
+
78
+ .. code-block:: console
79
+
80
+ mutmut run "my_module*"
81
+ mutmut run "my_module.my_function*"
82
+
83
+ In the `browse` TUI you can press `f` to retest a function, and `m` to retest
84
+ an entire module.
85
+
86
+
87
+ "also copy" files
88
+ -----------------
89
+
90
+ To run the full test suite some files are often needed above the tests and the
91
+ source. You can configure to copy extra files that you need by adding
92
+ directories and files to `also_copy` in your `setup.cfg`:
93
+
94
+ .. code-block:: ini
95
+
96
+ also_copy=
97
+ iommi/snapshots/
98
+ conftest.py
99
+
100
+
101
+ Limit stack depth
102
+ -----------------
103
+
104
+ In big code bases some functions are called incidentally by huge swaths of the
105
+ codebase, but you really don't want tests that hit those executions to count
106
+ for mutation testing purposes. Incidentally tested functions lead to slow
107
+ mutation testing as hundreds of tests can be checked for things that should
108
+ have clean and fast unit tests, and it leads to bad test suites as any
109
+ introduced bug in those base functions will lead to many tests that fail which
110
+ are hard to understand how they relate to the function with the change.
111
+
112
+ You can configure mutmut to only count a test as being relevant for a function
113
+ if the stack depth from the test to the function is below some limit. In your
114
+ `setup.cfg` add:
115
+
116
+ .. code-block:: ini
117
+
118
+ max_stack_depth=8
119
+
120
+ A lower value will increase mutation speed and lead to more localized tests,
121
+ but will also lead to more surviving mutants that would otherwise have been
122
+ caught.
123
+
124
+
125
+ Exclude files from mutation
126
+ ---------------------------
127
+
128
+ You can exclude files from mutation in `setup.cfg`:
129
+
130
+ .. code-block::
131
+
132
+ do_not_mutate=
133
+ *__tests.py
134
+
135
+
136
+ Whitelisting
137
+ ------------
138
+
139
+ You can mark lines like this:
140
+
141
+ .. code-block:: python
142
+
143
+ some_code_here() # pragma: no mutate
144
+
145
+ to stop mutation on those lines. Some cases we've found where you need to
146
+ whitelist lines are:
147
+
148
+ - The version string on your library. You really shouldn't have a test for this :P
149
+ - Optimizing break instead of continue. The code runs fine when mutating break
150
+ to continue, but it's slower.
151
+
152
+
153
+ Example mutations
154
+ -----------------
155
+
156
+ - Integer literals are changed by adding 1. So 0 becomes 1, 5 becomes 6, etc.
157
+ - `<` is changed to `<=`
158
+ - break is changed to continue and vice versa
159
+
160
+ In general the idea is that the mutations should be as subtle as possible.
161
+ See `__init__.py` for the full list.
162
+
163
+
164
+ Workflow
165
+ --------
166
+
167
+ This section describes how to work with mutmut to enhance your test suite.
168
+
169
+ 1. Run mutmut with `mutmut run`. A full run is preferred but if you're just
170
+ getting started you can exit in the middle and start working with what you
171
+ have found so far.
172
+ 2. Show the mutants with `mutmut browse`
173
+ 3. Find a mutant you want to work on and write a test to try to kill it.
174
+ 4. Press `r` to rerun the mutant and see if you successfully managed to kill it.
175
+
176
+ Mutmut keeps the data of what it has done and the mutants in the `mutants/`
177
+ directory.If you want to make sure you run a full mutmut run you can delete
178
+ this directory to start from scratch.