Skip to content

Commit ddbaaf1

Browse files
authored
Merge pull request #377 from Otto-AA/browse-show-killed
Add --show-killed option for mutmut browse
2 parents d1adfc2 + 258a0e6 commit ddbaaf1

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

mutmut/__main__.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,7 +1179,8 @@ def apply_mutant(mutant_name):
11791179
# TODO: junitxml, html commands
11801180

11811181
@cli.command()
1182-
def browse():
1182+
@click.option("--show-killed", is_flag=True, default=False, help="Display killed mutants.")
1183+
def browse(show_killed):
11831184
read_config()
11841185

11851186
from textual.app import App
@@ -1275,9 +1276,8 @@ def on_data_table_row_highlighted(self, event):
12751276
source_file_mutation_data, stat = self.source_file_mutation_data_and_stat_by_path[event.row_key.value]
12761277
for k, v in source_file_mutation_data.exit_code_by_key.items():
12771278
status = status_by_exit_code[v]
1278-
if status == 'killed':
1279-
continue
1280-
mutants_table.add_row(k, emoji_by_status[status], key=k)
1279+
if status != 'killed' or show_killed:
1280+
mutants_table.add_row(k, emoji_by_status[status], key=k)
12811281
else:
12821282
assert event.data_table.id == 'mutants'
12831283
# noinspection PyTypeChecker
@@ -1302,8 +1302,9 @@ def load_thread():
13021302

13031303
def retest(self, pattern):
13041304
with self.suspend():
1305-
assert sys.argv[-1] == 'browse'
1306-
subprocess.run([sys.executable, *sys.argv[:-1], 'run', pattern])
1305+
browse_index = sys.argv.index('browse')
1306+
initial_args = sys.argv[:browse_index]
1307+
subprocess.run([sys.executable, *initial_args, 'run', pattern])
13071308
input('press enter to return to browser')
13081309

13091310
self.read_data()

0 commit comments

Comments
 (0)