Set COLUMNS in Linux CI workflow to prevent regressions (#11589)

## Summary

When tests are run downstream, the `COLUMNS` environment variable is
used to force fixed output width and avoid test failures due to
different terminal widths. However, this occasionally causes test
regressions when other tests rely on different output width. Use the
same `COLUMNS` value in CI to ensure consistent output and catch any
regressions.

## Test Plan

It wasn't, it's supposed to be tested by the CI :-).

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
This commit is contained in:
Michał Górny 2025-02-18 17:38:28 +01:00 committed by GitHub
parent c3fc75d97e
commit aca7be8378
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 23 additions and 10 deletions

View file

@ -644,4 +644,9 @@ impl EnvVars {
/// error.
#[attr_hidden]
pub const UV_RUN_MAX_RECURSION_DEPTH: &'static str = "UV_RUN_MAX_RECURSION_DEPTH";
/// Overrides terminal width used for wrapping. This variable is not read by uv directly.
///
/// This is a quasi-standard variable, described e.g. in `ncurses(3x)`.
pub const COLUMNS: &'static str = "COLUMNS";
}

View file

@ -562,7 +562,11 @@ impl TestContext {
command
// When running the tests in a venv, ignore that venv, otherwise we'll capture warnings.
.env_remove(EnvVars::VIRTUAL_ENV)
// Disable wrapping of uv output for readability / determinism in snapshots.
.env(EnvVars::UV_NO_WRAP, "1")
// While we disable wrapping in uv above, invoked tools may still wrap their output so
// we set a fixed `COLUMNS` value for isolation from terminal width.
.env(EnvVars::COLUMNS, "100")
.env(EnvVars::PATH, path)
.env(EnvVars::HOME, self.home_dir.as_os_str())
.env(EnvVars::UV_PYTHON_INSTALL_DIR, "")

View file

@ -1824,13 +1824,12 @@ fn tool_run_verbatim_name() {
.arg("change_wheel_version")
.arg("--help")
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r"
success: true
exit_code: 0
----- stdout -----
usage: change_wheel_version [-h] [--local-version LOCAL_VERSION]
[--version VERSION] [--delete-old-wheel]
[--allow-same-version]
usage: change_wheel_version [-h] [--local-version LOCAL_VERSION] [--version VERSION]
[--delete-old-wheel] [--allow-same-version]
wheel
positional arguments:
@ -1851,7 +1850,7 @@ fn tool_run_verbatim_name() {
+ installer==0.7.0
+ packaging==24.0
+ wheel==0.43.0
"###);
");
uv_snapshot!(context.filters(), context.tool_run()
.arg("change-wheel-version")
@ -1877,13 +1876,12 @@ fn tool_run_verbatim_name() {
.arg("change_wheel_version")
.arg("--help")
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r"
success: true
exit_code: 0
----- stdout -----
usage: change_wheel_version [-h] [--local-version LOCAL_VERSION]
[--version VERSION] [--delete-old-wheel]
[--allow-same-version]
usage: change_wheel_version [-h] [--local-version LOCAL_VERSION] [--version VERSION]
[--delete-old-wheel] [--allow-same-version]
wheel
positional arguments:
@ -1898,5 +1896,5 @@ fn tool_run_verbatim_name() {
----- stderr -----
Resolved [N] packages in [TIME]
"###);
");
}