From f5a33c2b269896d3615be19ddd98b8f8c2a4d098 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Wed, 15 Feb 2023 16:16:45 +0000 Subject: [PATCH] =?UTF-8?q?tests:=20Temporarily=20don=E2=80=99t=20print=20?= =?UTF-8?q?out=20test=20environments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Printing the environment can fail on CI when running against a commit whose author name or commit message contains non-ASCII characters. These values are put into the CI environment in UTF-8 as, for example, the `CI_COMMIT_AUTHOR` environment variable, by GitLab. The CI environment on Windows is not set up with a UTF-8 codepage for console output, so when Python tries to print the environment, it fails with a `UnicodeEncodeError`. Arguably either (or both): * GitLab should be encoding the environment values in the same codepage as it subsequently runs the CI job in. * The CI configuration in `.gitlab-ci.yml` should switch to a UTF-8 codepage for the sanity of anyone who uses GLib’s CI system. But both of those are harder to fix, and this problem has blocked multiple pending merge requests in the last week. So this commit, which is defnitely a temporarily workaround, is proposed. Printing the environment was originally added to help debug problems with running subprocesses in the tests, so should not be needed on a day-to-day basis. Signed-off-by: Philip Withnall Helps: #2915 --- gio/tests/codegen.py | 2 +- glib/tests/assert-msg-test.py | 4 ++-- glib/tests/messages-low-memory.py | 2 +- gobject/tests/genmarshal.py | 2 +- gobject/tests/gobject-query.py | 2 +- gobject/tests/mkenums.py | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gio/tests/codegen.py b/gio/tests/codegen.py index d2d8c72263..3c4cf099dd 100644 --- a/gio/tests/codegen.py +++ b/gio/tests/codegen.py @@ -95,7 +95,7 @@ class TestCodegen(unittest.TestCase): env = os.environ.copy() env["LC_ALL"] = "C.UTF-8" - print("Environment:", env) + # print("Environment:", env) # We want to ensure consistent line endings... info = subprocess.run( diff --git a/glib/tests/assert-msg-test.py b/glib/tests/assert-msg-test.py index 4936fa0832..f3f112a19b 100755 --- a/glib/tests/assert-msg-test.py +++ b/glib/tests/assert-msg-test.py @@ -78,7 +78,7 @@ class TestAssertMessage(unittest.TestCase): env = os.environ.copy() env["LC_ALL"] = "C.UTF-8" - print("Environment:", env) + # print("Environment:", env) # We want to ensure consistent line endings... info = subprocess.run( @@ -108,7 +108,7 @@ class TestAssertMessage(unittest.TestCase): env = os.environ.copy() env["LC_ALL"] = "C.UTF-8" - print("Environment:", env) + # print("Environment:", env) # We want to ensure consistent line endings... info = subprocess.run( diff --git a/glib/tests/messages-low-memory.py b/glib/tests/messages-low-memory.py index 8e071b1647..c5a195fbe4 100644 --- a/glib/tests/messages-low-memory.py +++ b/glib/tests/messages-low-memory.py @@ -63,7 +63,7 @@ class TestMessagesLowMemory(unittest.TestCase): env = os.environ.copy() env["LC_ALL"] = "C.UTF-8" - print("Environment:", env) + # print("Environment:", env) # We want to ensure consistent line endings... info = subprocess.run( diff --git a/gobject/tests/genmarshal.py b/gobject/tests/genmarshal.py index 1062dfe625..30b7aad651 100644 --- a/gobject/tests/genmarshal.py +++ b/gobject/tests/genmarshal.py @@ -88,7 +88,7 @@ class TestGenmarshal(unittest.TestCase): env = os.environ.copy() env["LC_ALL"] = "C.UTF-8" - print("Environment:", env) + # print("Environment:", env) # We want to ensure consistent line endings... info = subprocess.run( diff --git a/gobject/tests/gobject-query.py b/gobject/tests/gobject-query.py index 618b6bae91..11f1d31919 100644 --- a/gobject/tests/gobject-query.py +++ b/gobject/tests/gobject-query.py @@ -59,7 +59,7 @@ class TestGobjectQuery(unittest.TestCase): env = os.environ.copy() env["LC_ALL"] = "C.UTF-8" - print("Environment:", env) + # print("Environment:", env) # We want to ensure consistent line endings... info = subprocess.run( diff --git a/gobject/tests/mkenums.py b/gobject/tests/mkenums.py index b58d23e799..df89d1b16a 100644 --- a/gobject/tests/mkenums.py +++ b/gobject/tests/mkenums.py @@ -100,7 +100,7 @@ class TestMkenums(unittest.TestCase): env = os.environ.copy() env["LC_ALL"] = "C.UTF-8" - print("Environment:", env) + # print("Environment:", env) # We want to ensure consistent line endings... info = subprocess.run( -- GitLab