Merge pull request #6079 from blueyed/tryfirst

mark: move pytest_cmdline_main.tryfist into decorator
This commit is contained in:
Daniel Hahler 2019-10-27 07:21:31 +01:00 committed by GitHub
commit cbc39dd86e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 4 deletions

View File

@ -8,6 +8,7 @@ from .structures import MARK_GEN
from .structures import MarkDecorator
from .structures import MarkGenerator
from .structures import ParameterSet
from _pytest.config import hookimpl
from _pytest.config import UsageError
__all__ = ["Mark", "MarkDecorator", "MarkGenerator", "get_empty_parameterset_mark"]
@ -74,6 +75,7 @@ def pytest_addoption(parser):
parser.addini(EMPTY_PARAMETERSET_OPTION, "default marker for empty parametersets")
@hookimpl(tryfirst=True)
def pytest_cmdline_main(config):
import _pytest.config
@ -91,10 +93,6 @@ def pytest_cmdline_main(config):
return 0
# Ignore type because of https://github.com/python/mypy/issues/2087.
pytest_cmdline_main.tryfirst = True # type: ignore
def deselect_by_keyword(items, config):
keywordexpr = config.option.keyword.lstrip()
if not keywordexpr: