Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: suppress step timings for verbosity=1 #2891 #2992

Merged
merged 1 commit into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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