From f25227416da47dc8d9e586d9e8d442d2475e499f Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 13 Oct 2022 22:29:52 -0400 Subject: [PATCH 1/3] fix: hide root pip warning on Linux again Signed-off-by: Henry Schreiner --- cibuildwheel/linux.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cibuildwheel/linux.py b/cibuildwheel/linux.py index 80a626398..c30c2ef4c 100644 --- a/cibuildwheel/linux.py +++ b/cibuildwheel/linux.py @@ -189,6 +189,8 @@ def build_in_container( log.step("Setting up build environment...") env = container.get_environment() + env["PIP_DISABLE_PIP_VERSION_CHECK"] = "1" + env["PIP_ROOT_USER_ACTION"] = "ignore" # put this config's python top of the list python_bin = config.path / "bin" From f259bfd4d67e94b579ef6afd2477bb682f60652c Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Wed, 26 Oct 2022 09:36:53 -0400 Subject: [PATCH 2/3] tests: add a check in tests for the pip warning Signed-off-by: Henry Schreiner --- test/test_0_basic.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/test_0_basic.py b/test/test_0_basic.py index 5fb7a2410..18969f1a2 100644 --- a/test/test_0_basic.py +++ b/test/test_0_basic.py @@ -20,7 +20,7 @@ ) -def test(tmp_path, build_frontend_env): +def test(tmp_path, build_frontend_env, capfd): project_dir = tmp_path / "project" basic_project.generate(project_dir) @@ -31,6 +31,10 @@ def test(tmp_path, build_frontend_env): expected_wheels = utils.expected_wheels("spam", "0.1.0") assert set(actual_wheels) == set(expected_wheels) + # Verify pip warning not shown + captured = capfd.readouterr() + assert "WARNING: Running pip as the 'root' user can result" not in captured.err + @pytest.mark.skip(reason="to keep test output clean") def test_sample_build(tmp_path, capfd): From db1208430e15277e7c850be89a9724431137c8da Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Wed, 26 Oct 2022 09:47:17 -0400 Subject: [PATCH 3/3] tests: include check for upgrade notice too --- test/test_0_basic.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/test_0_basic.py b/test/test_0_basic.py index 18969f1a2..0a4a0f046 100644 --- a/test/test_0_basic.py +++ b/test/test_0_basic.py @@ -33,7 +33,9 @@ def test(tmp_path, build_frontend_env, capfd): # Verify pip warning not shown captured = capfd.readouterr() - assert "WARNING: Running pip as the 'root' user can result" not in captured.err + for stream in (captured.err, captured.out): + assert "WARNING: Running pip as the 'root' user can result" not in stream + assert "A new release of pip available" not in stream @pytest.mark.skip(reason="to keep test output clean")