diff options
author | Sorin Sbarnea <ssbarnea@users.noreply.github.com> | 2020-09-19 19:56:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-19 15:56:52 -0300 |
commit | b031a7cecfe66367b0767300f454669b6234508f (patch) | |
tree | 0974c3189246ae8b7e5e71a9ffb30609ddb5728f /testing/test_config.py | |
parent | 9f164b72278c9057da4e09239687533aef99c463 (diff) | |
download | pytest-b031a7cecfe66367b0767300f454669b6234508f.tar.gz |
Smoke tests for assorted plugins (#7721)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Co-authored-by: Kyle Altendorf <sda@fstab.net>
Diffstat (limited to 'testing/test_config.py')
-rw-r--r-- | testing/test_config.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/testing/test_config.py b/testing/test_config.py index aa84a3cf5..0cfd11fd5 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -422,6 +422,25 @@ class TestParseIni: else: testdir.parseconfig() + def test_early_config_cmdline(self, testdir, monkeypatch): + """early_config contains options registered by third-party plugins. + + This is a regression involving pytest-cov (and possibly others) introduced in #7700. + """ + testdir.makepyfile( + myplugin=""" + def pytest_addoption(parser): + parser.addoption('--foo', default=None, dest='foo') + + def pytest_load_initial_conftests(early_config, parser, args): + assert early_config.known_args_namespace.foo == "1" + """ + ) + monkeypatch.setenv("PYTEST_PLUGINS", "myplugin") + testdir.syspathinsert() + result = testdir.runpytest("--foo=1") + result.stdout.fnmatch_lines("* no tests ran in *") + class TestConfigCmdlineParsing: def test_parsing_again_fails(self, testdir): |