How a UTF-8 Checkmark in a Pytest Message Crashed Tests on Linux Servers
A developer spent two days debugging a pytest crash that only appeared on Linux servers and never reproduced on their Mac. The root cause was a locale mismatch: many cloud Linux images boot with LANG=C or LANG=POSIX, which sets stdout encoding to ASCII, making Python raise a UnicodeEncodeError when pytest tried to print a failure message containing a checkmark symbol. The crash occurred during output rendering, not during test logic, making it resemble a test failure rather than a reporter error. The developer found that environment variables like LANG, along with sys and locale settings, fully explained the gap between laptop and server behavior. The experience highlighted how minimal Linux images often lack UTF-8 locale configuration that macOS and modern terminals silently provide by default.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in