add terminalreporter.section|line methods to print extra information.
This commit is contained in:
@@ -317,7 +317,7 @@ class TestFunctional:
|
||||
request.applymarker(pytest.mark.hello)
|
||||
def pytest_terminal_summary(terminalreporter):
|
||||
l = terminalreporter.stats['passed']
|
||||
terminalreporter._tw.line("keyword: %s" % l[0].keywords)
|
||||
terminalreporter.writer.line("keyword: %s" % l[0].keywords)
|
||||
""")
|
||||
testdir.makepyfile("""
|
||||
def test_func(arg):
|
||||
|
||||
@@ -699,3 +699,16 @@ def test_tbstyle_native_setup_error(testdir):
|
||||
result.stdout.fnmatch_lines([
|
||||
'*File *test_tbstyle_native_setup_error.py", line *, in setup_error_fixture*'
|
||||
])
|
||||
|
||||
def test_terminal_summary(testdir):
|
||||
testdir.makeconftest("""
|
||||
def pytest_terminal_summary(terminalreporter):
|
||||
w = terminalreporter
|
||||
w.section("hello")
|
||||
w.line("world")
|
||||
""")
|
||||
result = testdir.runpytest()
|
||||
result.stdout.fnmatch_lines("""
|
||||
*==== hello ====*
|
||||
world
|
||||
""")
|
||||
|
||||
Reference in New Issue
Block a user