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

bugfix: mutmut should pick up the config before running the original test suite #305

Merged

Conversation

atmay
Copy link
Contributor

@atmay atmay commented Feb 13, 2024

Bug: mutmut reads the config file stored in mutmut_config.py only after it runs the initial set of tests. Some tests (like end-to-end, integration tests etc) can't pass without certain infrastructure and are not even supposed to be part of mutation testing process.

As a result they fail before mutmut accesses the config file with runner command and mutmut can't proceed and crashes as well.

Fix: Reading configs prior to running initial set of tests allows to specify test suits you want to run and avoid crashes.

Example: Let's say, you have unit tests in tests/unit/ folder and you want to run only them. You can configure your mutmut_config.py like so:

from pathlib import Path


def init():
    test_files = (Path(__file__).parent / "tests/unit").rglob("test*.py")


def pre_mutation(context):
    context.config.test_command = "poetry run pytest tests/unit"

…tests. That allows to specify test suits you want to run
@boxed boxed merged commit efbfe14 into boxed:master Feb 13, 2024
3 checks passed
@boxed
Copy link
Owner

boxed commented Feb 13, 2024

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants