[Piglit] [PATCH] core.py: move a function definition out of a loop

Dylan Baker baker.dylan.c at gmail.com
Wed Aug 28 12:09:50 PDT 2013


Defining a function inside a loop is silly.

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

diff --git a/framework/core.py b/framework/core.py
index b1a5726..5c64606 100644
--- a/framework/core.py
+++ b/framework/core.py
@@ -443,6 +443,9 @@ class Test:
         def status(msg):
             log(msg=msg, channel=path)
 
+        def serious_level(result):
+            return {'skip':0, 'pass':1, 'warn':2, 'fail':3, 'crash':4}.get(result, 0)
+
         # Run the test
         if env.execute:
             try:
@@ -470,9 +473,6 @@ class Test:
             status(result['result'])
 
             if 'subtest' in result and len(result['subtest'].keys()) > 1:
-                def serious_level(result):
-                    return {'skip':0, 'pass':1, 'warn':2, 'fail':3, 'crash':4}.get(result, 0)
-
                 for test in result['subtest'].keys():
                     if serious_level(result['subtest'][test]) >= serious_level(result['result']):
                         result['result'] = result['subtest'][test]
-- 
1.8.1.5



More information about the Piglit mailing list