Skip to content

Conversation

@Otto-AA
Copy link
Collaborator

@Otto-AA Otto-AA commented Sep 21, 2025

Closes #423, #417, #398

From my point of view, this PR is finished. But I did not commit directly, in case you have feedback.

This adds the options:

  • pytest_add_cli_args: general args, e.g. changing the config file, overriding config options, disabling plugins
  • pytest_add_cli_args_test_selection: test selection args, e.g. "tests/", "-k 'foo and not bar'", "-m 'not slow'", ...

Also PytestRunner.list_all_tests now only returns selected tests. If pytest_add_cli_args_test_selection excludes some tests, this would have previously also returned the excluded tests, causing trouble if mutmut is run multiple times (reported here).

I did not name it pytest_addopts because pytest_addopts expects a string, and the new configs expect a list. I am using a list, because we pass the args as a list to pytest and I did not want to re-implement the option parsing of pytest.

tests_dir is now a special case of pytest_add_cli_args_test_selection, so I've removed tests_dir from the documentation and replaced it with pytest_add_cli_args_test_selection. But tests_dir still works if it's used.

@boxed boxed merged commit fef6d4a into main Sep 21, 2025
10 checks passed
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.

How do I pass additional pytest options from command line / config file to mutation runs?

3 participants