[Piglit] [PATCH 4/6] generated_tests/test_generators: print better error messages
Dylan Baker
baker.dylan.c at gmail.com
Thu Mar 3 01:21:00 UTC 2016
Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
generated_tests/test_generators.py | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/generated_tests/test_generators.py b/generated_tests/test_generators.py
index ac28592..207684c 100644
--- a/generated_tests/test_generators.py
+++ b/generated_tests/test_generators.py
@@ -129,17 +129,14 @@ def test_generators():
def test(name):
"""Tester function."""
- msg = ''
-
- try:
- with open(os.devnull, 'w') as d:
- rcode = subprocess.check_call(['python', name], stderr=d,
- stdout=d)
- except subprocess.CalledProcessError as e:
- msg = "While calling {}:\n{}".format(name, str(e))
- rcode = e.returncode
-
- nt.eq_(rcode, 0, msg)
+ with open(os.devnull, 'w') as d:
+ proc = subprocess.Popen(['python', name],
+ stderr=subprocess.PIPE,
+ stdout=d)
+ _, err = proc.communicate()
+
+ nt.eq_(proc.returncode, 0,
+ "While calling {}:\n{}".format(name, str(err)))
description = 'generator: {} runs successfully'
--
2.7.2
More information about the Piglit
mailing list