When I run mutmut (either 3.2.1 or from the main branch here) inside the project venv I get this errors:
Error processing line 1 of /home/eloi/dev/python-scim/scim2-models/.venv/lib/python3.12/site-packages/_virtualenv.pth:
Traceback (most recent call last):
File "<frozen site>", line 206, in addpackage
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named '_virtualenv'
Remainder of file ignored
Error processing line 1 of /home/eloi/dev/python-scim/scim2-models/.venv/lib/python3.12/site-packages/pre_commit_uv_patch.pth:
Traceback (most recent call last):
File "<frozen site>", line 206, in addpackage
File "<string>", line 1, in <module>
AttributeError: module 'pre_commit_uv' has no attribute '_patch'
Remainder of file ignored
Error processing line 1 of /home/eloi/dev/python-scim/scim2-models/.venv/lib/python3.12/site-packages/_virtualenv.pth:
Traceback (most recent call last):
File "<frozen site>", line 206, in addpackage
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named '_virtualenv'
Remainder of file ignored
Error processing line 1 of /home/eloi/dev/python-scim/scim2-models/.venv/lib/python3.12/site-packages/pre_commit_uv_patch.pth:
Traceback (most recent call last):
File "<frozen site>", line 206, in addpackage
File "<string>", line 1, in <module>
AttributeError: module 'pre_commit_uv' has no attribute '_patch'
Remainder of file ignored
Usage: mutmut [OPTIONS] COMMAND [ARGS]...
Options:
--help Show this message and exit.
Commands:
apply
browse
print-time-estimates
results
run
show
tests-for-mutant
And mutmut run gives me this:
mutmut run
Error processing line 1 of /home/eloi/dev/python-scim/scim2-models/.venv/lib/python3.12/site-packages/_virtualenv.pth:
Traceback (most recent call last):
File "<frozen site>", line 206, in addpackage
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named '_virtualenv'
Remainder of file ignored
Error processing line 1 of /home/eloi/dev/python-scim/scim2-models/.venv/lib/python3.12/site-packages/pre_commit_uv_patch.pth:
Traceback (most recent call last):
File "<frozen site>", line 206, in addpackage
File "<string>", line 1, in <module>
AttributeError: module 'pre_commit_uv' has no attribute '_patch'
Remainder of file ignored
Error processing line 1 of /home/eloi/dev/python-scim/scim2-models/.venv/lib/python3.12/site-packages/_virtualenv.pth:
Traceback (most recent call last):
File "<frozen site>", line 206, in addpackage
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named '_virtualenv'
Remainder of file ignored
Error processing line 1 of /home/eloi/dev/python-scim/scim2-models/.venv/lib/python3.12/site-packages/pre_commit_uv_patch.pth:
Traceback (most recent call last):
File "<frozen site>", line 206, in addpackage
File "<string>", line 1, in <module>
AttributeError: module 'pre_commit_uv' has no attribute '_patch'
Remainder of file ignored
⠋ Generating mutants
done in 3ms
⠙ Running stats
Traceback (most recent call last):
File "/home/eloi/dev/python-scim/scim2-models/.venv/bin/mutmut", line 8, in <module>
sys.exit(cli())
^^^^^
File "/home/eloi/dev/python-scim/scim2-models/.venv/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/eloi/dev/python-scim/scim2-models/.venv/lib/python3.12/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/home/eloi/dev/python-scim/scim2-models/.venv/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/eloi/dev/python-scim/scim2-models/.venv/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/eloi/dev/python-scim/scim2-models/.venv/lib/python3.12/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/eloi/dev/python-scim/scim2-models/.venv/lib/python3.12/site-packages/mutmut/__main__.py", line 1238, in run
collect_or_load_stats(runner)
File "/home/eloi/dev/python-scim/scim2-models/.venv/lib/python3.12/site-packages/mutmut/__main__.py", line 1064, in collect_or_load_stats
run_stats_collection(runner)
File "/home/eloi/dev/python-scim/scim2-models/.venv/lib/python3.12/site-packages/mutmut/__main__.py", line 1042, in run_stats_collection
collect_stats_exit_code = runner.run_stats(tests=tests)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/eloi/dev/python-scim/scim2-models/.venv/lib/python3.12/site-packages/mutmut/__main__.py", line 724, in run_stats
return int(self.execute_pytest(['-x', '-q', '--import-mode=append'] + list(tests), plugins=[stats_collector]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/eloi/dev/python-scim/scim2-models/.venv/lib/python3.12/site-packages/mutmut/__main__.py", line 701, in execute_pytest
exit_code = int(pytest.main(params, **kwargs))
^^^^^^^^^^^
AttributeError: module 'pytest' has no attribute 'main'
I run Archlinux with Python 3.12, and here is the output of uv pip freeze:
If I run the same project with Python 3.9 instead I have different errors:
$ uv venv --python 3.9
$ uv sync
$ uv pip install mutmut
$ mutmut
Usage: mutmut [OPTIONS] COMMAND [ARGS]...
Options:
--help Show this message and exit.
Commands:
apply
browse
print-time-estimates
results
run
show
tests-for-mutant
$ mutmut run
⠋ Generating mutants
done in 4ms
⠙ Running stats
Traceback (most recent call last):
File "/home/eloi/dev/python-scim/scim2-models/.venv/bin/mutmut", line 8, in <module>
sys.exit(cli())
File "/home/eloi/dev/python-scim/scim2-models/.venv/lib/python3.9/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
File "/home/eloi/dev/python-scim/scim2-models/.venv/lib/python3.9/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
File "/home/eloi/dev/python-scim/scim2-models/.venv/lib/python3.9/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/eloi/dev/python-scim/scim2-models/.venv/lib/python3.9/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/eloi/dev/python-scim/scim2-models/.venv/lib/python3.9/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "/home/eloi/dev/python-scim/scim2-models/.venv/lib/python3.9/site-packages/mutmut/__main__.py", line 1238, in run
collect_or_load_stats(runner)
File "/home/eloi/dev/python-scim/scim2-models/.venv/lib/python3.9/site-packages/mutmut/__main__.py", line 1064, in collect_or_load_stats
run_stats_collection(runner)
File "/home/eloi/dev/python-scim/scim2-models/.venv/lib/python3.9/site-packages/mutmut/__main__.py", line 1042, in run_stats_collection
collect_stats_exit_code = runner.run_stats(tests=tests)
File "/home/eloi/dev/python-scim/scim2-models/.venv/lib/python3.9/site-packages/mutmut/__main__.py", line 724, in run_stats
return int(self.execute_pytest(['-x', '-q', '--import-mode=append'] + list(tests), plugins=[stats_collector]))
File "/home/eloi/dev/python-scim/scim2-models/.venv/lib/python3.9/site-packages/mutmut/__main__.py", line 705, in execute_pytest
raise BadTestExecutionCommandsException(params)
mutmut.__main__.BadTestExecutionCommandsException: ['--doctest-modules', '--doctest-glob=*.rst', '-x', '-q', '--import-mode=append', '--rootdir=.']
This error looks a lot like the one in #340.
If I run this command by hand at the project root it gives me this:
$ pytest --doctest-modules '--doctest-glob=*.rst' -x -q --import-mode=append --rootdir=.
====================================================== ERRORS ======================================================
__________________________________ ERROR collecting mutants/scim2_models/base.py ___________________________________
import file mismatch:
imported module 'scim2_models.base' has this __file__ attribute:
/home/eloi/dev/python-scim/scim2-models/scim2_models/base.py
which is not the same as the test file we want to collect:
/home/eloi/dev/python-scim/scim2-models/mutants/scim2_models/base.py
HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules
============================================= short test summary info ==============================================
ERROR mutants/scim2_models/base.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1 error in 0.02s
If I run the command by hand from the mutants dir I get this:
If I remove conftest.py from the root of the project, it looks like I have a new issue with pydantic:
$ mutmut run
⠼ Generating mutants
done in 4ms
⠼ Running stats
====================================================== ERRORS ======================================================
____________________________________ ERROR collecting scim2_models/__init__.py _____________________________________
scim2_models/__init__.py:46: in <module>
from .base import BaseModel
scim2_models/base.py:2255: in <module>
class BaseModel(PydanticBaseModel):
../.venv/lib/python3.9/site-packages/pydantic/_internal/_model_construction.py:115: in __new__
private_attributes = inspect_namespace(
../.venv/lib/python3.9/site-packages/pydantic/_internal/_model_construction.py:428: in inspect_namespace
raise PydanticUserError(
E pydantic.errors.PydanticUserError: A non-annotated attribute was detected: `xǁBaseModelǁmark_with_schema__mutmut_mutants = {'xǁBaseModelǁmark_with_schema__mutmut_1': <function BaseModel.xǁBaseModelǁmark_with_schema__mutmut_1 at 0x7ae5be304af0>, 'xǁBaseModelǁmark_with_schema__mutmut_2': <function BaseModel.xǁBaseModelǁmark_with_schema__mutmut_2 at 0x7ae5be304b80>, 'xǁBaseModelǁmark_with_schema__mutmut_3': <function BaseModel.xǁBaseModelǁmark_with_schema__mutmut_3 at 0x7ae5be304c10>, 'xǁBaseModelǁmark_with_schema__mutmut_4': <function BaseModel.xǁBaseModelǁmark_with_schema__mutmut_4 at 0x7ae5be304ca0>, 'xǁBaseModelǁmark_with_schema__mutmut_5': <function BaseModel.xǁBaseModelǁmark_with_schema__mutmut_5 at 0x7ae5be304d30>, 'xǁBaseModelǁmark_with_schema__mutmut_6': <function BaseModel.xǁBaseModelǁmark_with_schema__mutmut_6 at 0x7ae5be304dc0>, 'xǁBaseModelǁmark_with_schema__mutmut_7': <function BaseModel.xǁBaseModelǁmark_with_schema__mutmut_7 at 0x7ae5be304e50>, 'xǁBaseModelǁmark_with_schema__mutmut_8': <function BaseModel.xǁBaseModelǁmark_with_schema__mutmut_8 at 0x7ae5be304ee0>, 'xǁBaseModelǁmark_with_schema__mutmut_9': <function BaseModel.xǁBaseModelǁmark_with_schema__mutmut_9 at 0x7ae5be304f70>, 'xǁBaseModelǁmark_with_schema__mutmut_10': <function BaseModel.xǁBaseModelǁmark_with_schema__mutmut_10 at 0x7ae5be30b040>, 'xǁBaseModelǁmark_with_schema__mutmut_11': <function BaseModel.xǁBaseModelǁmark_with_schema__mutmut_11 at 0x7ae5be30b0d0>, 'xǁBaseModelǁmark_with_schema__mutmut_12': <function BaseModel.xǁBaseModelǁmark_with_schema__mutmut_12 at 0x7ae5be30b160>, 'xǁBaseModelǁmark_with_schema__mutmut_13': <function BaseModel.xǁBaseModelǁmark_with_schema__mutmut_13 at 0x7ae5be30b1f0>, 'xǁBaseModelǁmark_with_schema__mutmut_14': <function BaseModel.xǁBaseModelǁmark_with_schema__mutmut_14 at 0x7ae5be30b280>, 'xǁBaseModelǁmark_with_schema__mutmut_15': <function BaseModel.xǁBaseModelǁmark_with_schema__mutmut_15 at 0x7ae5be30b310>, 'xǁBaseModelǁmark_with_schema__mutmut_16': <function BaseModel.xǁBaseModelǁmark_with_schema__mutmut_16 at 0x7ae5be30b3a0>, 'xǁBaseModelǁmark_with_schema__mutmut_17': <function BaseModel.xǁBaseModelǁmark_with_schema__mutmut_17 at 0x7ae5be30b430>, 'xǁBaseModelǁmark_with_schema__mutmut_18': <function BaseModel.xǁBaseModelǁmark_with_schema__mutmut_18 at 0x7ae5be30b4c0>, 'xǁBaseModelǁmark_with_schema__mutmut_19': <function BaseModel.xǁBaseModelǁmark_with_schema__mutmut_19 at 0x7ae5be30b550>, 'xǁBaseModelǁmark_with_schema__mutmut_20': <function BaseModel.xǁBaseModelǁmark_with_schema__mutmut_20 at 0x7ae5be30b5e0>, 'xǁBaseModelǁmark_with_schema__mutmut_21': <function BaseModel.xǁBaseModelǁmark_with_schema__mutmut_21 at 0x7ae5be30b670>, 'xǁBaseModelǁmark_with_schema__mutmut_22': <function BaseModel.xǁBaseModelǁmark_with_schema__mutmut_22 at 0x7ae5be30b700>, 'xǁBaseModelǁmark_with_schema__mutmut_23': <function BaseModel.xǁBaseModelǁmark_with_schema__mutmut_23 at 0x7ae5be30b790>, 'xǁBaseModelǁmark_with_schema__mutmut_24': <function BaseModel.xǁBaseModelǁmark_with_schema__mutmut_24 at 0x7ae5be30b820>}`. All model fields require a type annotation; if `xǁBaseModelǁmark_with_schema__mutmut_mutants` is not meant to be a field, you may be able to resolve this error by annotating it as a `ClassVar` or updating `model_config['ignored_types']`.
E
E For further information visit https://errors.pydantic.dev/2.9/u/model-field-missing-annotation
============================================= short test summary info ==============================================
ERROR scim2_models/__init__.py - pydantic.errors.PydanticUserError: A non-annotated attribute was detected: `xǁBa...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1 error in 0.17s
failed to collect stats. runner returned 1
I wanted to try mutmut against scim2-models. My
setup.cfg
file looks like this:When I run
mutmut
(either 3.2.1 or from the main branch here) inside the project venv I get this errors:And
mutmut run
gives me this:I run Archlinux with Python 3.12, and here is the output of
uv pip freeze
:If I run the same project with Python 3.9 instead I have different errors:
This error looks a lot like the one in #340.
If I run this command by hand at the project root it gives me this:
If I run the command by hand from the
mutants
dir I get this:If I remove
conftest.py
from the root of the project, it looks like I have a new issue with pydantic: