Skip to content

Commit 9d40df0

Browse files
committed
Add basic description for all results in mutmut browse
1 parent cb9fedb commit 9d40df0

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
@@ -1421,7 +1421,7 @@ def on_data_table_row_highlighted(self, event):
14211421
else:
14221422
assert event.data_table.id == 'mutants'
14231423
# noinspection PyTypeChecker
1424-
description: Static = self.query_one('#description')
1424+
description_view: Static = self.query_one('#description')
14251425
mutant_name = event.row_key.value
14261426
self.loading_id = mutant_name
14271427
path = self.path_by_name.get(mutant_name)
@@ -1432,10 +1432,28 @@ def on_data_table_row_highlighted(self, event):
14321432
estimated_duration = source_file_mutation_data.estimated_time_of_tests_by_mutant.get(mutant_name, '?')
14331433
duration = source_file_mutation_data.durations_by_key.get(mutant_name, '?')
14341434

1435-
if status == 'timeout':
1436-
description.update(f'Timed out because tests did not finish within {duration:.3f} seconds. Tests without mutation took {estimated_duration:.3f} seconds.\n')
1437-
else:
1438-
description.update('')
1435+
match status:
1436+
case 'killed':
1437+
description = f'Killed ({exit_code=}): Mutant got detected by a test.'
1438+
case 'survived':
1439+
description = f'Survived ({exit_code=}): No test detected this mutant.'
1440+
case 'skipped':
1441+
description = f'Skipped ({exit_code=})'
1442+
case 'check was interrupted by user':
1443+
description = f'User interrupt ({exit_code=})'
1444+
case 'timeout':
1445+
description = f'Timeout ({exit_code=}): Timed out because tests did not finish within {duration:.3f} seconds. Tests without mutation took {estimated_duration:.3f} seconds.'
1446+
case 'no tests':
1447+
description = f'Untested ({exit_code=}): Skipped because selected tests do not execute this code.'
1448+
case 'segfault':
1449+
description = f'Segfault ({exit_code=}): Running pytest with this mutant segfaulted.'
1450+
case 'suspicious':
1451+
description = f'Unknown ({exit_code=}): Unknown pytest exit code'
1452+
case 'not checked':
1453+
description = 'Not checked in the last mutmut run.'
1454+
case _:
1455+
description = f'Unknown status ({exit_code=}, {status=})'
1456+
description_view.update(f'\n {description}\n')
14391457

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

0 commit comments

Comments
 (0)