From: Matthew Fernandez Date: Thu, 14 Jul 2022 14:38:45 +0000 (-0700) Subject: fix test suite 'dot' reliance on locale X-Git-Tag: 5.0.1~36^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ca47f619433b0f5356e8b97615496765bed5834a;p=graphviz fix test suite 'dot' reliance on locale This function was using the current system locale to encode and decode data sent to Graphviz and received from Graphviz when using a textual output format. As a result, encoding exceptions would occur if either the input or the output contained non-ASCII characters and the system locale was not a UTF-8 one. Apparently none of the current test suite hits this scenario. However, an upcoming commit adds a test case that does. This change forces the encoding and decoding to be done as UTF-8, which is also what Graphviz unconditionally uses. --- diff --git a/tests/gvtest.py b/tests/gvtest.py index ed44a872d..cfe5344c0 100644 --- a/tests/gvtest.py +++ b/tests/gvtest.py @@ -87,6 +87,7 @@ def dot(T: str, source_file: Optional[Path] = None, source: Optional[str] = None kwargs = {} if output_is_text: + kwargs["encoding"] = "utf-8" kwargs["universal_newlines"] = True args = ["dot", f"-T{T}"]