[Piglit] [PATCH 2/2] tests/py_modules/constants.py: make dosify function return unicode

Dylan Baker baker.dylan.c at gmail.com
Fri Apr 1 19:23:22 UTC 2016


This also got missed in the big unicode conversion. subprocess.Popen
(and it's wrappers like check_output) return bytes, but the module
expects UTF-8 unicode. This fixes that by decoding the output
appropriately.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 tests/py_modules/constants.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/py_modules/constants.py b/tests/py_modules/constants.py
index a4c84bf..a4e7fb3 100644
--- a/tests/py_modules/constants.py
+++ b/tests/py_modules/constants.py
@@ -34,7 +34,8 @@ GENERATED_TESTS_DIR = os.path.abspath(
 # If on cygwin convert to a dos style path
 if sys.platform == 'cygwin':
     def dosify(p):
-        return subprocess.check_output(['cygpath', '-d', p]).rstrip()
+        return subprocess.check_output(
+            ['cygpath', '-d', p]).rstrip().decode('utf-8')
 
     TESTS_DIR = dosify(TESTS_DIR)
     GENERATED_TESTS_DIR = dosify(GENERATED_TESTS_DIR)
-- 
2.8.0



More information about the Piglit mailing list