Commit 31a1b586 authored by Sam Thursfield's avatar Sam Thursfield

functional-tests: Reduce noise on failed extractor tests

parent 080a08f3
......@@ -237,10 +237,13 @@ def run_one (filename):
sys.exit(not result.wasSuccessful())
if len(sys.argv) == 2:
run_one (sys.argv[1])
elif len(sys.argv) == 1:
run_all ()
sys.stderr.write("Too many arguments.")
if len(sys.argv) == 2:
run_one (sys.argv[1])
elif len(sys.argv) == 1:
run_all ()
raise RuntimeError("Too many arguments.")
except RuntimeError as e:
sys.stderr.write("ERROR: %s\n" % e)
......@@ -41,16 +41,23 @@ def get_tracker_extract_jsonld_output(filename, mime_type=None):
env = os.environ.copy()
log ('Running: %s' % ' '.join(command))
p = subprocess.Popen (command, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = p.communicate()
if p.returncode != 0:
raise RuntimeError(
"tracker-extract returned non-zero exit code: %s\n"
"Error output:\n%s\n" % (p.returncode, stderr.decode('unicode-escape').strip()))
if len(stderr) > 0:
log ("Error output from tracker-extract:\n%s" % stderr.decode('unicode-escape').strip())
log ('Running: %s' % ' '.join(command))
output = subprocess.check_output (command, env=env)
except subprocess.CalledProcessError as e:
raise Exception("Error %i from %s, output, see stderr for details" %
(e.returncode, tracker_extract))
output = stdout.decode('utf-8')
data = json.loads(output)
except ValueError as e:
raise RuntimeError("Invalid JSON returned by tracker-extract: "
"%s.\nOutput was: %s" % (e, output))
raise RuntimeError("tracker-extract did not return valid JSON data: %s\n"
"Output was: %s" % (e, output))
return data
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment