Skip to content

Support ty for filtering mutants #521

Description

@ejfine

I (and hopefully others) would like to follow this issue to know when it's available. Being able to use a very fast type checker to filter out mutants I think will dramatically increase the utility of mutmut

I saw

With pyright and ty, mutating a class method Foo.bar() can break the types of all methods of Foo, and therefore mutmut cannot match the type error with the mutant that caused the type error.

in the Readme. But I'm not sure I understand why that would prevent using ty. Wouldn't the logic just need to be:

  1. mutmut makes a mutation
  2. the type checker is run
  3. if the type checker throws any error, then the mutation is considered invalid
  4. if no type checker error, then proceed with unit test suite to see if mutation is caught by that

I'm not sure I understand why mutmut would need to match the type error with the mutant. Would that requirement only apply to codebases where there are existing errors detected by the type checker, and therefore the type checker exiting non-zero wouldn't be able to be clearly tied to the introduced mutation?

Or if there's more nuanced logic involved in the current mypy implementation, would it be easy (and useful to others) for this simpler flow to exist?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions