[Piglit] [Patch v2 12/13] exectest.py: mark some methods as private

Dylan Baker baker.dylan.c at gmail.com
Tue May 13 11:38:45 PDT 2014


In python the convention to mark a method as private (or really, 'we
don't guarantee that this isn't going to change') is to mark it with a
leading underscore. The same is true for classes, functions and
constants that are helpers for use inside a module.

This patch marks some methods and constants as not meant for use outside
of the module.

v2: - various cleanups and refactors

Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
---
 framework/exectest.py | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/framework/exectest.py b/framework/exectest.py
index 1d630de..18448b7 100644
--- a/framework/exectest.py
+++ b/framework/exectest.py
@@ -48,11 +48,7 @@ __all__ = ['Test',
            'add_shader_test_dir',
            'TEST_BIN_DIR']
 
-# Platform global variables
-if 'PIGLIT_PLATFORM' in os.environ:
-    PIGLIT_PLATFORM = os.environ['PIGLIT_PLATFORM']
-else:
-    PIGLIT_PLATFORM = ''
+_PIGLIT_PLATFORM = os.environ.get('PIGLIT_PLATFORM', '')
 
 if 'PIGLIT_BUILD_DIR' in os.environ:
     TEST_BIN_DIR = os.path.join(os.environ['PIGLIT_BUILD_DIR'], 'bin')
@@ -171,7 +167,7 @@ class Test(object):
         # https://bugzilla.gnome.org/show_bug.cgi?id=680214 is affecting many
         # developers. If we catch it happening, try just re-running the test.
         for _ in xrange(5):
-            self.get_command_result()
+            self._run_command()
             if "Got spurious window resize" not in self.result['out']:
                 break
 
@@ -218,7 +214,7 @@ class Test(object):
         """
         return False
 
-    def get_command_result(self):
+    def _run_command(self):
         fullenv = os.environ.copy()
         for key, value in self.env.iteritems():
             fullenv[key] = str(value)
@@ -284,7 +280,7 @@ class PiglitTest(Test):
         If we are running on gbm don't run glean or glx- tests
 
         """
-        if PIGLIT_PLATFORM == 'gbm':
+        if _PIGLIT_PLATFORM == 'gbm':
             split_command = os.path.split(self._command[0])[1]
             if split_command.startswith('glx-'):
                 return True
@@ -318,7 +314,7 @@ class GleanTest(Test):
         return super(GleanTest, self).command + self.GLOBAL_PARAMS
 
     def check_for_skip_scenario(self):
-        if PIGLIT_PLATFORM == 'gbm':
+        if _PIGLIT_PLATFORM == 'gbm':
             return True
         return False
 
-- 
2.0.0.rc2



More information about the Piglit mailing list