fix issue547 2.6 regression: capsys/capfd now work again when output capturing ("-s") is disabled.

This commit is contained in:
holger krekel 2014-07-28 13:17:37 +02:00
parent ba878c6d9d
commit 1265612465
3 changed files with 6 additions and 5 deletions

View File

@ -1,6 +1,8 @@
NEXT
-----------------------------------
- fix issue547 capsys/capfd also work when output capturing ("-s") is disabled.
- address issue170: allow pytest.mark.xfail(...) to specify expected exceptions via
an optional "raises=EXC" argument where EXC can be a single exception
or a tuple of exception classes. Thanks David Mohr for the complete

View File

@ -33,8 +33,6 @@ def pytest_addoption(parser):
def pytest_load_initial_conftests(early_config, parser, args, __multicall__):
ns = early_config.known_args_namespace
pluginmanager = early_config.pluginmanager
if ns.capture == "no":
return
capman = CaptureManager(ns.capture)
pluginmanager.register(capman, "capturemanager")

View File

@ -392,13 +392,14 @@ class TestLoggingInteraction:
class TestCaptureFixture:
def test_std_functional(self, testdir):
@pytest.mark.parametrize("opt", [[], ["-s"]])
def test_std_functional(self, testdir, opt):
reprec = testdir.inline_runsource("""
def test_hello(capsys):
print (42)
out, err = capsys.readouterr()
assert out.startswith("42")
""")
""", *opt)
reprec.assertoutcome(passed=1)
def test_capsyscapfd(self, testdir):