Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suport to python 3.10 #281

Open
leonardostefan opened this issue May 26, 2023 · 10 comments
Open

Suport to python 3.10 #281

leonardostefan opened this issue May 26, 2023 · 10 comments

Comments

@leonardostefan
Copy link

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?

@boxed
Copy link
Owner

boxed commented May 26, 2023

Blocked by davidhalter/parso#138

@gulliver-madrid
Copy link

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.

@boxed
Copy link
Owner

boxed commented Apr 16, 2024

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 🤷

@nkhitrov
Copy link

Hello there! Any news?

@boxed
Copy link
Owner

boxed commented Jun 14, 2024

Read the linked issues for parso

@nkhitrov
Copy link

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

@boxed
Copy link
Owner

boxed commented Jun 14, 2024

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
Copy link
Owner

boxed commented Jun 14, 2024

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

@yonkeltron
Copy link

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?

@FrozenDude101
Copy link

FrozenDude101 commented Sep 1, 2024

I think this is related to parso, any python file using the "type" keyword added in 3.12 errors:
parso.parser.ParserSyntaxError: ('SyntaxError: invalid syntax', <ErrorLeaf: PythonTokenTypes.NAME:'Foo', (17, 5)>)
The above exception was the direct cause of the following exception:
RuntimeError: Failed while creating mutations for pyastodon/models\application.py, for line "from typing import Optional"

A minimal file is just:
type Foo = int

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants