diff options
author | Alexis Hildebrandt <afh@surryhill.net> | 2015-02-20 14:02:16 +0100 |
---|---|---|
committer | Alexis Hildebrandt <afh@surryhill.net> | 2015-02-20 14:02:16 +0100 |
commit | 34f8c482414775cfb75de32b4181150642a4610d (patch) | |
tree | 71e38f36574a56e54b349325669276000c3e742e /test/DocTests.py | |
parent | f5b8fe59565ead295dce0a42b701703e24ca8e40 (diff) | |
download | fork-ledger-34f8c482414775cfb75de32b4181150642a4610d.tar.gz fork-ledger-34f8c482414775cfb75de32b4181150642a4610d.tar.bz2 fork-ledger-34f8c482414775cfb75de32b4181150642a4610d.zip |
[tests] Improve error reporting for test/DocTests.py
Diffstat (limited to 'test/DocTests.py')
-rwxr-xr-x | test/DocTests.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/test/DocTests.py b/test/DocTests.py index 671c4d35..6f0276da 100755 --- a/test/DocTests.py +++ b/test/DocTests.py @@ -184,23 +184,25 @@ class DocTests: test_file_created = True with open(test_file, 'w') as f: f.write(input) - error = False elif os.path.exists(os.path.join(test_input_dir, test_file)): command[findex] = os.path.join(test_input_dir, test_file) try: + error = None + try: verify = subprocess.check_output(command, stderr=subprocess.STDOUT) - except: - verify = str() - error = True - valid = (output == verify) or (not error and validation) + valid = (output == verify) or (not error and validation) + except subprocess.CalledProcessError, e: + error = e.output + valid = False + failed.add(test_id) if valid and test_file_created: os.remove(test_file) if self.verbose > 0: - print test_id, ':', 'Passed' if valid else 'FAILED' + print test_id, ':', 'Passed' if valid else 'FAILED: {}'.format(error) if error else 'FAILED' else: sys.stdout.write('.' if valid else 'E') - if not valid: + if not (valid or error): failed.add(test_id) if self.verbose > 1: print ' '.join(command) |