[Piglit] [PATCH 04/35] framework/test: Use getter for altering PiglitBaseTest Command

Dylan Baker dylan at pnwbakers.com
Wed Apr 4 22:26:52 UTC 2018


This removes mutation of the class, and pushes the change out to run
time instead of build time. This is better coding style, and is required
for XML serialization, since paths need to be relative in the XML, and
made absolute at runtime.
---
 framework/test/piglit_test.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/framework/test/piglit_test.py b/framework/test/piglit_test.py
index cc129ed..3d5b156 100644
--- a/framework/test/piglit_test.py
+++ b/framework/test/piglit_test.py
@@ -70,8 +70,11 @@ class PiglitBaseTest(ValgrindMixin, Test):
     def __init__(self, command, run_concurrent=True, **kwargs):
         super(PiglitBaseTest, self).__init__(command, run_concurrent, **kwargs)
 
+    @Test.command.getter
+    def command(self):
         # Prepend TEST_BIN_DIR to the path.
-        self._command[0] = os.path.join(TEST_BIN_DIR, self._command[0])
+        cmd = os.path.join(TEST_BIN_DIR, super(PiglitBaseTest, self).command[0])
+        return [cmd] + self._command[1:]
 
     def interpret_result(self):
         out = []
-- 
git-series 0.9.1


More information about the Piglit mailing list