diff options
author | Daniel Hahler <git@thequod.de> | 2019-03-21 04:50:51 +0100 |
---|---|---|
committer | Daniel Hahler <git@thequod.de> | 2019-03-21 17:01:50 +0100 |
commit | 553951c44381bf554a20d656534f616873f0fbc6 (patch) | |
tree | b091f66a894d662c5ade041df0cd469e008191d7 /testing/test_config.py | |
parent | 15ef1688216645e5e69778ae5b5ae278f9821e90 (diff) | |
download | pytest-553951c44381bf554a20d656534f616873f0fbc6.tar.gz |
Fix some issues related to "-p no:X" with default_plugins
Diffstat (limited to 'testing/test_config.py')
-rw-r--r-- | testing/test_config.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/testing/test_config.py b/testing/test_config.py index 50a40a2cb..57cbd10ee 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -15,6 +15,7 @@ from _pytest.config.findpaths import determine_setup from _pytest.config.findpaths import get_common_ancestor from _pytest.config.findpaths import getcfg from _pytest.main import EXIT_NOTESTSCOLLECTED +from _pytest.main import EXIT_OK from _pytest.main import EXIT_TESTSFAILED from _pytest.main import EXIT_USAGEERROR @@ -1189,3 +1190,41 @@ def test_config_does_not_load_blocked_plugin_from_args(testdir): result = testdir.runpytest(str(p), "-pno:capture", "-s") result.stderr.fnmatch_lines(["*: error: unrecognized arguments: -s"]) assert result.ret == EXIT_USAGEERROR + + +@pytest.mark.parametrize( + "plugin", + [ + x + for x in _pytest.config.default_plugins + if x + not in [ + "fixtures", + "helpconfig", # Provides -p. + "main", + "mark", + "python", + "runner", + "terminal", # works in OK case (no output), but not with failures. + ] + ], +) +def test_config_blocked_default_plugins(testdir, plugin): + if plugin == "debugging": + # https://github.com/pytest-dev/pytest-xdist/pull/422 + try: + import xdist # noqa: F401 + except ImportError: + pass + else: + pytest.skip("does not work with xdist currently") + + p = testdir.makepyfile("def test(): pass") + result = testdir.runpytest(str(p), "-pno:%s" % plugin) + assert result.ret == EXIT_OK + result.stdout.fnmatch_lines(["* 1 passed in *"]) + + p = testdir.makepyfile("def test(): assert 0") + result = testdir.runpytest(str(p), "-pno:%s" % plugin) + assert result.ret == EXIT_TESTSFAILED + result.stdout.fnmatch_lines(["* 1 failed in *"]) |