Skip to content

Commit 229db0f

Browse files
Supply status for missing exit codes
Following on from the work in "Handle -9 PyTest return code", discussion with @Otto-AA and @boxed revealed it would be desirable to handle missing return codes in full generality. The simplest way I could think of to _do_ that, trying to eliminate side effects, is to convert status_by_exit_code to a defaultdict, with a default value of "suspicious" - one already defined, and handled, elsewhere in the codebase.
1 parent 1e46f1b commit 229db0f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mutmut/__main__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
# TODO: hash of function. If hash changes, retest all mutants as mutant IDs are not stable
6868

6969

70-
status_by_exit_code = {
70+
status_by_exit_code = defaultdict(lambda: 'suspicious', {
7171
1: 'killed',
7272
3: 'killed', # internal error in pytest means a kill
7373
-24: 'killed',
@@ -85,7 +85,7 @@
8585
255: 'timeout',
8686
-11: 'segfault',
8787
-9: 'segfault',
88-
}
88+
})
8989

9090
emoji_by_status = {
9191
'survived': '🙁',

0 commit comments

Comments
 (0)