mutmut icon indicating copy to clipboard operation
mutmut copied to clipboard

pre_mutation skip on line causing a wrong %?

Open ejocharcole opened this issue 4 years ago • 2 comments

I've not been using 'mutmut' long so I've probably made a configuration error, but can't see what it might be

I'm wanting to exclude logging and injection, so I have in mutmut_config.py

def pre_mutation(context):
    line = context.current_source_line.strip()

    if line.startswith('inject') or line.startswith('logging.'):
        context.skip = True

only affects one file in my application, and there's 4 mutations skipped I believe, with the current code

the odd thing, is the final percentage - in my html report I get

Total | Killed | % killed | Survived 11 | 15 | 73.33 | 0

it's as if the skipped mutations are being included in the killed and the % for some reason is total/killed?

Have I made a silly mistake with my config there?

(if I remove the code I'm currently skipping - no surviving mutations, all %s correct)

thanks

ejocharcole avatar Mar 30 '21 21:03 ejocharcole

Should have mentioned- I have another file I skip altogether, as abstract.

if 'etc_service.py' in context.filename: context.skip = True

this has this effect in my html report:

Total | Killed | % killed | Survived 0 | 2 | 0.00 | 0

which seems the same sort of thing? skipped counting as killed?

ejocharcole avatar Mar 30 '21 21:03 ejocharcole

That looks very wrong yea.

boxed avatar Mar 31 '21 11:03 boxed