boxed / mutmut

Mutation testing system
https://mutmut.readthedocs.io
BSD 3-Clause "New" or "Revised" License
924 stars 112 forks source link

string mutation causes UnicodeDecodeError #253

Closed golankai closed 2 weeks ago

golankai commented 2 years ago

I am working on a project that includes text normalization and using mutmut for mutation testing. mutmut is mutating line 35 to be normalized = 'XXXX' instead of normalized = '' image

I then get the following error: image

when I run my tests regularly they work, and when I apply this change manually and run my tests, they work too.

Have any Idea what can happen that causes this failure?

boxed commented 2 years ago

Are you sure this is the mutation that fails? Is that what you get with mutmut show 0?

"position 35" in the error would be the column 35, not the line 35 of the file.

golankai commented 2 years ago

the position is indeed 35, but coincidently also the row I referred to :) when reporting the error, the position changes, as it is using a random string from Hypothesis testing. I am sure.

  1. Running the tests themselves produces no error.
  2. Applying the mutation manually and running the tests produces an assertion error (this is good) but not a fatal Error of 'utf-8'.
  3. running mutmut run crashes as I showed above, and then also by running mutmut run 4 (4 is the id of this mutant).

This is quite weird. I have seen before in our project those errors that comes from normalization, but I don't get how and why this mutant causes them, only when running through mutmut.

boxed commented 2 years ago

Weird. You could add a print(repr(line)) in the mutmut code.

boxed commented 2 weeks ago

I just released mutmut 3, which is a big rewrite. I believe this issue no longer applies anymore. Feel free to reopen it if it still exists.