Skip to content

Commit

Permalink
Feature: suppress step timings for verbosity=1 tox-dev#2891
Browse files Browse the repository at this point in the history
  • Loading branch information
nedbat committed Apr 24, 2023
1 parent 47f13f5 commit d9c6aa7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/changelog/2891.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
When run with verbosity=1, the per-step timing summaries are suppressed at the
end of the run. Thanks to :user:`nedbat` at the PyCon 2023 sprints.
2 changes: 1 addition & 1 deletion src/tox/session/cmd/run/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def _print(color_: int, message: str) -> None:
for run in runs:
successful.append(run.code == Outcome.OK or run.ignore_outcome)
skipped.append(run.skipped)
duration_individual = [o.elapsed for o in run.outcomes]
duration_individual = [o.elapsed for o in run.outcomes] if verbosity >= 2 else []
extra = f"+cmd[{','.join(f'{i:.2f}' for i in duration_individual)}]" if duration_individual else ""
setup = run.duration - sum(duration_individual)
msg, color = _get_outcome_message(run)
Expand Down
10 changes: 10 additions & 0 deletions tests/session/cmd/test_sequential.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ def _cmd(value: int) -> str:
assert Matches(r" a: FAIL code 1 \(.*=setup\[.*\]\+cmd\[.*\] seconds\)") == reports[-3]


def test_run_sequential_quiet(tox_project: ToxProjectCreator) -> None:
ini = "[tox]\nenv_list=a\nno_package=true\n[testenv]\ncommands=python -V"
project = tox_project({"tox.ini": ini})
outcome = project.run("r", "-q", "-e", "a")
outcome.assert_success()
reports = outcome.out.splitlines()[-3:]
assert Matches(r" congratulations :\) \(.* seconds\)") == reports[-1]
assert Matches(r" a: OK \([\d.]+ seconds\)") == reports[-2]


@pytest.mark.integration()
def test_result_json_sequential(
tox_project: ToxProjectCreator,
Expand Down

0 comments on commit d9c6aa7

Please sign in to comment.