diff --git a/taskflow/tests/test_examples.py b/taskflow/tests/test_examples.py index f526b94c..c9b95b42 100644 --- a/taskflow/tests/test_examples.py +++ b/taskflow/tests/test_examples.py @@ -52,10 +52,18 @@ def run_example(name): obj = subprocess.Popen([sys.executable, path], stdout=subprocess.PIPE, stderr=subprocess.PIPE) output = obj.communicate() - if output[1]: - raise RuntimeError('Example wrote to stderr:\n%s' - % output[1].decode()) - return output[0].decode() + stdout = output[0].decode() + stderr = output[1].decode() + + rc = obj.wait() + if rc != 0: + raise RuntimeError('Example %s failed, return code=%s\n' + '<<>>\n%s' + '<<>>\n' + '<<>>\n%s' + '<<>>' + % (name, rc, stdout, stderr)) + return stdout def expected_output_path(name): @@ -67,7 +75,7 @@ def list_examples(): for filename in os.listdir(examples_dir): name, ext = os.path.splitext(filename) if ext == ".py" and 'utils' not in name.lower(): - yield filename[:-len(ext)] + yield name class ExamplesTestCase(taskflow.test.TestCase):