Improve verbosity test

This commit is contained in:
Bruno Oliveira
2018-12-11 14:34:39 -02:00
parent 49c09117ed
commit 3332c99e1e

View File

@@ -358,15 +358,29 @@ class TestDistEach:
class TestTerminalReporting: class TestTerminalReporting:
def test_quiet_no_output(self, testdir): @pytest.mark.parametrize("verbosity", ["", "-q", "-v"])
def test_output_verbosity(self, testdir, verbosity):
testdir.makepyfile( testdir.makepyfile(
""" """
def test_ok(): def test_ok():
pass pass
""" """
) )
result = testdir.runpytest("-q") args = ["-n1"]
result.stdout.fnmatch_lines([".*[100%]*", "*1*passed*"]) if verbosity:
args.append(verbosity)
result = testdir.runpytest(*args)
out = result.stdout.str()
if verbosity == "-v":
assert "scheduling tests" in out
assert "gw" in out
elif verbosity == "-q":
assert "scheduling tests" not in out
assert "gw" not in out
assert "bringing up nodes..." in out
else:
assert "scheduling tests" not in out
assert "gw" in out
def test_pass_skip_fail(self, testdir): def test_pass_skip_fail(self, testdir):
testdir.makepyfile( testdir.makepyfile(