sixty-north / cosmic-ray

Mutation testing for Python
MIT License
556 stars 54 forks source link

Bug: killing exec can leave mutated code on disk #546

Closed abingham closed 2 months ago

abingham commented 2 months ago

We need to see why this hole isn't plugged. We need to always put code back in its original state, even in the face of control-c.

abingham commented 2 months ago

The problem is probably that we don't rollback file changes if the exception is thrown in apply_mutation(). That function needs to be made robust again control-c.

abingham commented 2 months ago

Fixed in 49c0d63b6cb8e03fe155fe958b006f0573f87e55.

I've switched back to using subprocess.run() rather than asyncio. Whatever problems we had in the past with subprocess.run don't seem to be a problem now. Or at least they haven't shown up. We'll see. The subprocess.run implementation is much cleaner and simpler, so I prefer it, all other things being equal.