Add pytest_add_cli_args and pytest_add_cli_args_test_selection configs
#440
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 pluginspytest_add_cli_args_test_selection: test selection args, e.g. "tests/", "-k 'foo and not bar'", "-m 'not slow'", ...Also
PytestRunner.list_all_testsnow only returns selected tests. Ifpytest_add_cli_args_test_selectionexcludes 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_addoptsbecausepytest_addoptsexpects 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_diris now a special case ofpytest_add_cli_args_test_selection, so I've removedtests_dirfrom the documentation and replaced it withpytest_add_cli_args_test_selection. Buttests_dirstill works if it's used.