[tracker-miners/sam/meson-writeback-extract-options: 2/2] functional-tests: Give clearer error when running the extractor failed



commit 59467d569861c41a5727da602c7a34031ab1f4d6
Author: Sam Thursfield <sam afuera me uk>
Date:   Sat Sep 15 17:19:46 2018 +0200

    functional-tests: Give clearer error when running the extractor failed
    
    These tests will fail if the extractor is disabled at build time.
    Let's make this fact obvious.

 tests/functional-tests/common/utils/extractor.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/tests/functional-tests/common/utils/extractor.py 
b/tests/functional-tests/common/utils/extractor.py
index b4f3f9f40..bdd305505 100644
--- a/tests/functional-tests/common/utils/extractor.py
+++ b/tests/functional-tests/common/utils/extractor.py
@@ -21,6 +21,7 @@
 
 from common.utils import configuration as cfg
 from common.utils.helpers import log
+import errno
 import json
 import os
 import re
@@ -42,7 +43,13 @@ def get_tracker_extract_jsonld_output(filename, mime_type=None):
     env['TRACKER_VERBOSITY'] = '0'
 
     log ('Running: %s' % ' '.join(command))
-    p = subprocess.Popen (command, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+    try:
+        p = subprocess.Popen (command, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+    except OSError as e:
+        if e.errno == errno.ENOENT:
+            raise RuntimeError("Did not find tracker-extract binary. Is the 'extract' option disabled?")
+        else:
+            raise RuntimeError("Error running tracker-extract: %s" % (e))
     stdout, stderr = p.communicate()
 
     if p.returncode != 0:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]