Skip to content

Commit caaa521

Browse files
committed
chore(ci): always print the full pytest command in CI
Check the `CI` environment variable so that `fill` (and other pytest-based commands) print the resolved `pytest ...` command line in GitHub Actions without requiring `-v`.
1 parent e8f01a6 commit caaa521

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

  • packages/testing/src/execution_testing/cli/pytest_commands

packages/testing/src/execution_testing/cli/pytest_commands/base.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Base classes and utilities for pytest-based CLI commands."""
22

3+
import os
34
import sys
45
from abc import ABC, abstractmethod
56
from dataclasses import dataclass, field
@@ -57,6 +58,15 @@ class PytestRunner:
5758
console: Console = field(default_factory=lambda: Console(highlight=False))
5859
"""Console to use for output."""
5960

61+
error_console: Console = field(
62+
default_factory=lambda: Console(stderr=True, highlight=False)
63+
)
64+
"""Console for diagnostic output.
65+
66+
Written to stderr so it doesn't pollute stdout captures such as the
67+
`fill --help` subprocess in `docs/scripts/generate_fill_help.py`.
68+
"""
69+
6070
def run_single(self, execution: PytestExecution) -> int:
6171
"""Run pytest once with the given configuration and arguments."""
6272
root_dir_arg = ["--rootdir", "."]
@@ -75,9 +85,9 @@ def run_single(self, execution: PytestExecution) -> int:
7585
"execution_testing.cli."
7686
"pytest_commands.plugins.fix_package_test_path",
7787
]
78-
if self._is_verbose(execution.args):
88+
if self._is_verbose(execution.args) or "CI" in os.environ:
7989
pytest_cmd = f"pytest {' '.join(pytest_args)}"
80-
self.console.print(f"Executing: [bold]{pytest_cmd}[/bold]")
90+
self.error_console.print(f"Executing: [bold]{pytest_cmd}[/bold]")
8191

8292
return pytest.main(pytest_args)
8393

0 commit comments

Comments
 (0)