MCPcopy
hub / github.com/pytest-dev/pytest / test_early_config_cmdline

Method test_early_config_cmdline

testing/test_config.py:659–678  ·  view source on GitHub ↗

early_config contains options registered by third-party plugins. This is a regression involving pytest-cov (and possibly others) introduced in #7700.

(
        self, pytester: Pytester, monkeypatch: MonkeyPatch
    )

Source from the content-addressed store, hash-verified

657 pytester.parseconfig()
658
659 def test_early_config_cmdline(
660 self, pytester: Pytester, monkeypatch: MonkeyPatch
661 ) -> None:
662 """early_config contains options registered by third-party plugins.
663
664 This is a regression involving pytest-cov (and possibly others) introduced in #7700.
665 """
666 pytester.makepyfile(
667 myplugin="""
668 def pytest_addoption(parser):
669 parser.addoption('--foo', default=None, dest='foo')
670
671 def pytest_load_initial_conftests(early_config, parser, args):
672 assert early_config.known_args_namespace.foo == "1"
673 """
674 )
675 monkeypatch.setenv("PYTEST_PLUGINS", "myplugin")
676 pytester.syspathinsert()
677 result = pytester.runpytest("--foo=1")
678 result.stdout.fnmatch_lines("* no tests ran in *")
679
680 def test_args_source_args(self, pytester: Pytester):
681 config = pytester.parseconfig("--", "test_filename.py")

Callers

nothing calls this directly

Calls 5

setenvMethod · 0.80
fnmatch_linesMethod · 0.80
makepyfileMethod · 0.45
syspathinsertMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected