fix issue547 2.6 regression: capsys/capfd now work again when output capturing ("-s") is disabled.
This commit is contained in:
parent
ba878c6d9d
commit
1265612465
|
@ -1,6 +1,8 @@
|
||||||
NEXT
|
NEXT
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
|
||||||
|
- fix issue547 capsys/capfd also work when output capturing ("-s") is disabled.
|
||||||
|
|
||||||
- address issue170: allow pytest.mark.xfail(...) to specify expected exceptions via
|
- address issue170: allow pytest.mark.xfail(...) to specify expected exceptions via
|
||||||
an optional "raises=EXC" argument where EXC can be a single exception
|
an optional "raises=EXC" argument where EXC can be a single exception
|
||||||
or a tuple of exception classes. Thanks David Mohr for the complete
|
or a tuple of exception classes. Thanks David Mohr for the complete
|
||||||
|
|
|
@ -33,8 +33,6 @@ def pytest_addoption(parser):
|
||||||
def pytest_load_initial_conftests(early_config, parser, args, __multicall__):
|
def pytest_load_initial_conftests(early_config, parser, args, __multicall__):
|
||||||
ns = early_config.known_args_namespace
|
ns = early_config.known_args_namespace
|
||||||
pluginmanager = early_config.pluginmanager
|
pluginmanager = early_config.pluginmanager
|
||||||
if ns.capture == "no":
|
|
||||||
return
|
|
||||||
capman = CaptureManager(ns.capture)
|
capman = CaptureManager(ns.capture)
|
||||||
pluginmanager.register(capman, "capturemanager")
|
pluginmanager.register(capman, "capturemanager")
|
||||||
|
|
||||||
|
|
|
@ -392,13 +392,14 @@ class TestLoggingInteraction:
|
||||||
|
|
||||||
|
|
||||||
class TestCaptureFixture:
|
class TestCaptureFixture:
|
||||||
def test_std_functional(self, testdir):
|
@pytest.mark.parametrize("opt", [[], ["-s"]])
|
||||||
|
def test_std_functional(self, testdir, opt):
|
||||||
reprec = testdir.inline_runsource("""
|
reprec = testdir.inline_runsource("""
|
||||||
def test_hello(capsys):
|
def test_hello(capsys):
|
||||||
print (42)
|
print (42)
|
||||||
out, err = capsys.readouterr()
|
out, err = capsys.readouterr()
|
||||||
assert out.startswith("42")
|
assert out.startswith("42")
|
||||||
""")
|
""", *opt)
|
||||||
reprec.assertoutcome(passed=1)
|
reprec.assertoutcome(passed=1)
|
||||||
|
|
||||||
def test_capsyscapfd(self, testdir):
|
def test_capsyscapfd(self, testdir):
|
||||||
|
|
Loading…
Reference in New Issue