Skip to content

Commit 3332c99

Browse files
committed
Improve verbosity test
1 parent 49c0911 commit 3332c99

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

testing/acceptance_test.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,15 +358,29 @@ def test_hello():
358358

359359

360360
class TestTerminalReporting:
361-
def test_quiet_no_output(self, testdir):
361+
@pytest.mark.parametrize("verbosity", ["", "-q", "-v"])
362+
def test_output_verbosity(self, testdir, verbosity):
362363
testdir.makepyfile(
363364
"""
364365
def test_ok():
365366
pass
366367
"""
367368
)
368-
result = testdir.runpytest("-q")
369-
result.stdout.fnmatch_lines([".*[100%]*", "*1*passed*"])
369+
args = ["-n1"]
370+
if verbosity:
371+
args.append(verbosity)
372+
result = testdir.runpytest(*args)
373+
out = result.stdout.str()
374+
if verbosity == "-v":
375+
assert "scheduling tests" in out
376+
assert "gw" in out
377+
elif verbosity == "-q":
378+
assert "scheduling tests" not in out
379+
assert "gw" not in out
380+
assert "bringing up nodes..." in out
381+
else:
382+
assert "scheduling tests" not in out
383+
assert "gw" in out
370384

371385
def test_pass_skip_fail(self, testdir):
372386
testdir.makepyfile(

0 commit comments

Comments
 (0)