Line numbers in junitxml report seem to be off by one
srazzell opened this issue · 7 comments
The "line" attribute of the testcases in the junitxml report seem to be off by one.
I ran mutmut run --paths-to-mutate "mutations/__main__.py"
, then ran mutmut junitxml
, and I get this output:
<testcase name="Mutant #12" file="mutations/__main__.py" line="21">
bug.txt
I attached a screenshot to show the line number for the file mutmut is running on. This happens with every mutation in the xml report.
Hmm. I guess just a +1
on https://github.com/boxed/mutmut/blob/master/mutmut/cache.py#L237
Could you try that and see if that fixes it?
Yes, that does fix it. I'm wondering where that number is calculated. Is it here?
https://github.com/boxed/mutmut/blob/master/mutmut/cache.py#L368
Line numbers should start at 1 right? So maybe adding +1
on line 368, or starting i
at 1
instead of 0 in the enumerate? That seems to cause issues. I guess there's a difference between the internal count of line numbers vs. the actual user facing line numbers.
Hmm. Yea try that.
Do you want me to make a PR with the +1 to https://github.com/boxed/mutmut/blob/master/mutmut/cache.py#L237 ? That fixes it for me.
That would be great!
PR was merged