Skip to content

Commit dc4327e

Browse files
committed
Add basic description for all results in mutmut browse
1 parent 5141b8a commit dc4327e

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

mutmut/__main__.py

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,7 +1408,7 @@ def on_data_table_row_highlighted(self, event):
14081408
else:
14091409
assert event.data_table.id == 'mutants'
14101410
# noinspection PyTypeChecker
1411-
description: Static = self.query_one('#description')
1411+
description_view: Static = self.query_one('#description')
14121412
mutant_name = event.row_key.value
14131413
self.loading_id = mutant_name
14141414
path = self.path_by_name.get(mutant_name)
@@ -1419,10 +1419,28 @@ def on_data_table_row_highlighted(self, event):
14191419
estimated_duration = source_file_mutation_data.estimated_time_of_tests_by_mutant.get(mutant_name, '?')
14201420
duration = source_file_mutation_data.durations_by_key.get(mutant_name, '?')
14211421

1422-
if status == 'timeout':
1423-
description.update(f'Timed out because tests did not finish within {duration:.3f} seconds. Tests without mutation took {estimated_duration:.3f} seconds.\n')
1424-
else:
1425-
description.update('')
1422+
match status:
1423+
case 'killed':
1424+
description = f'Killed ({exit_code=}): Mutant got detected by a test.'
1425+
case 'survived':
1426+
description = f'Survived ({exit_code=}): No test detected this mutant.'
1427+
case 'skipped':
1428+
description = f'Skipped ({exit_code=})'
1429+
case 'check was interrupted by user':
1430+
description = f'User interrupt ({exit_code=})'
1431+
case 'timeout':
1432+
description = f'Timeout ({exit_code=}): Timed out because tests did not finish within {duration:.3f} seconds. Tests without mutation took {estimated_duration:.3f} seconds.'
1433+
case 'no tests':
1434+
description = f'Untested ({exit_code=}): Skipped because selected tests do not execute this code.'
1435+
case 'segfault':
1436+
description = f'Segfault ({exit_code=}): Running pytest with this mutant segfaulted.'
1437+
case 'suspicious':
1438+
description = f'Unknown ({exit_code=}): Unknown pytest exit code'
1439+
case 'not checked':
1440+
description = 'Not checked in the last mutmut run.'
1441+
case _:
1442+
description = f'Unknown status ({exit_code=}, {status=})'
1443+
description_view.update(f'\n {description}\n')
14261444

14271445
diff_view: Static = self.query_one('#diff_view')
14281446
diff_view.update('<loading code diff...>')

0 commit comments

Comments
 (0)