[Bf-blender-cvs] [cc653c9b02b] master: Fix potential render tests error with invalid utf-8 characters

Brecht Van Lommel noreply at git.blender.org
Tue Sep 28 20:51:31 CEST 2021


Commit: cc653c9b02b34349e7896b8a4e92a5b0e69c0322
Author: Brecht Van Lommel
Date:   Tue Sep 28 20:36:20 2021 +0200
Branches: master
https://developer.blender.org/rBcc653c9b02b34349e7896b8a4e92a5b0e69c0322

Fix potential render tests error with invalid utf-8 characters

In general should not happen, but better to report the actual error instead
of the Python test code failing.

===================================================================

M	tests/performance/api/device.py
M	tests/python/modules/render_report.py

===================================================================

diff --git a/tests/performance/api/device.py b/tests/performance/api/device.py
index b61ae42be36..1e930a12352 100644
--- a/tests/performance/api/device.py
+++ b/tests/performance/api/device.py
@@ -11,7 +11,7 @@ def get_cpu_name() -> str:
         return platform.processor()
     elif platform.system() == "Darwin":
         cmd = ['/usr/sbin/sysctl', "-n", "machdep.cpu.brand_string"]
-        return subprocess.check_output(cmd).strip().decode('utf-8')
+        return subprocess.check_output(cmd).strip().decode('utf-8', 'ignore')
     else:
         with open('/proc/cpuinfo') as f:
             for line in f:
diff --git a/tests/python/modules/render_report.py b/tests/python/modules/render_report.py
index 560f8e33585..90f16dc80fb 100755
--- a/tests/python/modules/render_report.py
+++ b/tests/python/modules/render_report.py
@@ -410,7 +410,7 @@ class Report:
                 failed = False
             except subprocess.CalledProcessError as e:
                 if self.verbose:
-                    print_message(e.output.decode("utf-8"))
+                    print_message(e.output.decode("utf-8", 'ignore'))
                 failed = e.returncode != 1
         else:
             if not self.update:
@@ -437,7 +437,7 @@ class Report:
             subprocess.check_output(command)
         except subprocess.CalledProcessError as e:
             if self.verbose:
-                print_message(e.output.decode("utf-8"))
+                print_message(e.output.decode("utf-8", 'ignore'))
 
         return not failed
 
@@ -488,7 +488,7 @@ class Report:
             if verbose:
                 print(" ".join(command))
             if (verbose or crash) and output:
-                print(output.decode("utf-8"))
+                print(output.decode("utf-8", 'ignore'))
 
             # Detect missing filepaths and consider those errors
             for filepath, output_filepath in zip(remaining_filepaths[:], output_filepaths):



More information about the Bf-blender-cvs mailing list