Merge pull request #375 from ethanhs/silencenodes
Don't show node setup when running quiet
This commit is contained in:
1
changelog/373.feature.rst
Normal file
1
changelog/373.feature.rst
Normal file
@@ -0,0 +1 @@
|
||||
Node setup information is hidden when pytest is run in quiet mode to reduce noise on many-core machines.
|
||||
@@ -358,6 +358,30 @@ class TestDistEach:
|
||||
|
||||
|
||||
class TestTerminalReporting:
|
||||
@pytest.mark.parametrize("verbosity", ["", "-q", "-v"])
|
||||
def test_output_verbosity(self, testdir, verbosity):
|
||||
testdir.makepyfile(
|
||||
"""
|
||||
def test_ok():
|
||||
pass
|
||||
"""
|
||||
)
|
||||
args = ["-n1"]
|
||||
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):
|
||||
testdir.makepyfile(
|
||||
"""
|
||||
|
||||
@@ -229,6 +229,7 @@ class DSession(object):
|
||||
if self.terminal and not self.sched.has_pending:
|
||||
self.trdist.ensure_show_status()
|
||||
self.terminal.write_line("")
|
||||
if self.config.option.verbose > 0:
|
||||
self.terminal.write_line(
|
||||
"scheduling tests via %s" % (self.sched.__class__.__name__)
|
||||
)
|
||||
@@ -344,8 +345,11 @@ class TerminalDistReporter(object):
|
||||
self.rewrite(self.getstatus())
|
||||
|
||||
def getstatus(self):
|
||||
if self.config.option.verbose >= 0:
|
||||
parts = ["%s %s" % (spec.id, self._status[spec.id]) for spec in self._specs]
|
||||
return " / ".join(parts)
|
||||
else:
|
||||
return "bringing up nodes..."
|
||||
|
||||
def rewrite(self, line, newline=False):
|
||||
pline = line + " " * max(self._lastlen - len(line), 0)
|
||||
|
||||
Reference in New Issue
Block a user