Skip to content

tests: Ignore UnicodeEncodeErrors when printing test environments

Philip Withnall requested to merge pwithnall/glib:2915-catch-env-errors into main

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 more of a workaround, is proposed.

Signed-off-by: Philip Withnall pwithnall@endlessos.org

Helps: #2915 (closed)

Closes #2915 (closed)

Merge request reports

Loading