I'm posting this here to help out mutmut
's dev solve this issue, because he doesn't know how to fix it yet.
The issue has already been logged here.
Basically, what happens is that when you run mutmut
and tell it to run Mutation Tests for your project, after about 100 or so mutants, it just stops running, forcing you to run it again so it picks up where it left off.
While it doesn't happen for all mutmut
users, it still happens to some which makes it a very real issue.
Usually, it stops without printing any errors (which is wrong, because it's an unexpected termination), but it will very rarely print something like the following:
Exception in thread queue_mutants:
Traceback (most recent call last):
File "c:\python39\lib\site-packages\mutmut\__init__.py", line 712, in queue_mutants
Traceback (most recent call last):
mutants_queue.put(('mutant', context))
File "c:\python39\lib\multiprocessing\queues.py", line 88, in put
File "c:\python39\lib\multiprocessing\queues.py", line 247, in _feed
send_bytes(obj)
File "c:\python39\lib\multiprocessing\connection.py", line 205, in send_bytes
self._send_bytes(m[offset:offset + size])
raise ValueError(f"Queue {self!r} is closed")
File "c:\python39\lib\multiprocessing\connection.py", line 285, in _send_bytes
ov, err = _winapi.WriteFile(self._handle, buf, overlapped=True)
ValueError: Queue <multiprocessing.queues.Queue object at 0x000001617B72CCD0> is closed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\python39\lib\threading.py", line 954, in _bootstrap_inner
BrokenPipeError: [WinError 232] The pipe is being closed
From the above error, this seems to be a multiprocessing
or threading
issue.
IMPORTANT: If you want to try out this issue for yourself, please do so on a project that has been checked in to Source Control, because Mutation Testing tools manually change your code and then undo their changes during testing, which could lead to broken files if something unexpected occurs.
It seems that a medium to large project is preferable to help investigate this issue, as you require at least 200-300 mutants before the issue is reproduced.
I'm on Python 3.9.6
and I installed mutmut
with pip install mutmut
.
My mutmut
version is 2.1.0
.
For reference, my project is structured as follows, but other structures should work as well as long as your tests are isolated from your production code (which is in chalicelib
in this case):
my-project/
chalicelib/
tests/
Here's how I run mutmut
for my project:
mutmut run --paths-to-mutate=chalicelib/