diff --git a/changelog/373.feature.rst b/changelog/373.feature.rst new file mode 100644 index 0000000..5a11da4 --- /dev/null +++ b/changelog/373.feature.rst @@ -0,0 +1 @@ +Node setup information is hidden when pytest is run in quiet mode to reduce noise on many-core machines. diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index 8a06645..2c026d4 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -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( """ diff --git a/xdist/dsession.py b/xdist/dsession.py index be3ba77..8bb559c 100644 --- a/xdist/dsession.py +++ b/xdist/dsession.py @@ -229,9 +229,10 @@ class DSession(object): if self.terminal and not self.sched.has_pending: self.trdist.ensure_show_status() self.terminal.write_line("") - self.terminal.write_line( - "scheduling tests via %s" % (self.sched.__class__.__name__) - ) + if self.config.option.verbose > 0: + self.terminal.write_line( + "scheduling tests via %s" % (self.sched.__class__.__name__) + ) self.sched.schedule() def worker_logstart(self, node, nodeid, location): @@ -344,8 +345,11 @@ class TerminalDistReporter(object): self.rewrite(self.getstatus()) def getstatus(self): - parts = ["%s %s" % (spec.id, self._status[spec.id]) for spec in self._specs] - return " / ".join(parts) + 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)