From 792a4370edc2f99eef816275852f119113fee274 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Diemer?= <stephane.diemer@ubicast.eu>
Date: Mon, 13 Feb 2017 11:15:13 +0100
Subject: [PATCH] Added not testable status code (refs #20453).

---
 tester.py | 33 ++++++++++++++++++---------------
 1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/tester.py b/tester.py
index 0a3d0cc3..3af48d9b 100755
--- a/tester.py
+++ b/tester.py
@@ -157,27 +157,30 @@ class Tester():
         for name, description, command in tests:
             log('\033[1;95m-- Test "%s" --\033[0;0m' % name)
             # Run test
-            try:
-                p = subprocess.Popen(command, stdin=sys.stdin, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-                out, err = p.communicate()
-                if out:
-                    log(out.decode('utf-8').strip())
-                if err:
-                    log(err.decode('utf-8').strip())
-                if p.returncode != 0:
-                    raise Exception('Command exited with code %s.' % p.returncode)
-            except Exception as e:
-                exit_code = 1
-                log(e)
-                results.append((name, description, command, False))
+            p = subprocess.Popen(command, stdin=sys.stdin, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+            out, err = p.communicate()
+            if out:
+                log(out.decode('utf-8').strip())
+            if err:
+                log(err.decode('utf-8').strip())
+            if p.returncode == 0:
+                success = True
+            elif p.returncode == 2:
+                success = None
             else:
-                results.append((name, description, command, True))
+                success = False
+                exit_code = 1
+                log('Command exited with code %s.' % p.returncode)
+            results.append((name, description, command, success))
         # Display results
         log('\nTests results:')
         html_report = '<table border="1">'
         html_report += '\n<tr><th>Test</th><th>Result</th><th>Description</th></tr>'
         for name, description, command, success in results:
-            if success:
+            if success is None:
+                html_result = '<span style="color: blue;">not testable</span>'
+                term_result = '\033[94mnot testable\033[0m'
+            elif success:
                 html_result = '<span style="color: green;">success</span>'
                 term_result = '\033[92msuccess\033[0m'
             else:
-- 
GitLab