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
)
| 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") |
nothing calls this directly
no test coverage detected