mutmut icon indicating copy to clipboard operation
mutmut copied to clipboard

Support python 3.10+

Open leonardostefan opened this issue 2 years ago • 17 comments

I'm using mutmut in my work projects with python 3.10 and its working except for a single project that we are using the "new" syntax of match-case (PEP 634). In this case, mutmut broke and return 100% of mutants killeds

There's any planning to add full suport for python 3.10?

leonardostefan avatar May 26 '23 17:05 leonardostefan

Blocked by https://github.com/davidhalter/parso/issues/138

boxed avatar May 26 '23 20:05 boxed

While waiting for the full support of Python 3.10, is there any recommended workaround that could be used for projects employing the match-case syntax? Any tips would be greatly appreciated.

gulliver-madrid avatar Apr 16 '24 11:04 gulliver-madrid

Sorry, I don't really have anything to say to that. Extracting code you need to be mutation tested and testing it in a separate project is one way at least.. not great but 🤷

boxed avatar Apr 16 '24 12:04 boxed

Hello there! Any news?

nkhitrov avatar Jun 13 '24 20:06 nkhitrov

Read the linked issues for parso

boxed avatar Jun 14 '24 05:06 boxed

Last comment was 2 years ago. It looks like nobody cares about this problem. Maybe change the parser? For example, to libcst?

nkhitrov avatar Jun 14 '24 12:06 nkhitrov

Yea, that's one way to go for sure. I switched AST library for mutmut once before, and that wasn't as hard as one might expect. I'm very open to PRs, but I don't have much time for this myself.

boxed avatar Jun 14 '24 13:06 boxed

I've also thought about using whatever Ruff uses, or whatever black uses...

boxed avatar Jun 14 '24 13:06 boxed

FYI, there seems to be another issue which I've uncovered coming from parso. I'm not sure if it's the same or not, so please let me know if I should open up a new issue, instead.

This seems to be a parso problem with import asyncio:

$ mutmut run

- Mutation testing starting -

These are the steps:
1. A full test suite run will be made to make sure we
   can run the tests successfully and we know how long
   it takes (to detect infinite loops for example)
2. Mutants will be generated and checked

Results are stored in .mutmut-cache.
Print found mutants with `mutmut results`.

Legend for output:
🎉 Killed mutants.   The goal is for everything to end up in this bucket.
⏰ Timeout.          Test suite took 10 times as long as the baseline so were killed.
🤔 Suspicious.       Tests took a long time, but not long enough to be fatal.
🙁 Survived.         This means your tests need to be expanded.
🔇 Skipped.          Skipped.

mutmut cache is out of date, clearing it...
1. Running tests without mutations
⠸ Running...Done
Failed to parse app/cli/commands/relay_events/relay_handlers.py. Internal error from parso follows.
----------------------------------
Traceback (most recent call last):
  File "/virtualenvs/service-f1pOEzwg-py3.12/lib/python3.12/site-packages/parso/parser.py", line 180, in _add_token
    plan = stack[-1].dfa.transitions[transition]
           ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
KeyError: <PythonTokenTypes.NAME: TokenType(NAME)>

During handling of the above exception, another exception occurred:

SNIP

RuntimeError: Failed while creating mutations for app/cli/commands/relay_events/relay_handlers.py, for line "import asyncio"

Is this something new which needs a new issue or is this related to the same parso issue above?

yonkeltron avatar Jul 17 '24 19:07 yonkeltron