From d034f8f84e015b8581beafa1ccde2b50e710e550 Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Wed, 14 Jan 2004 07:20:49 +0000 Subject: [PATCH] * test/test_all.py Don't stop at the first failure, try to move further. Patch from Andre Hentz, with some tweaks by myself. [SVN r21724] --- v2/test/test_all.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/v2/test/test_all.py b/v2/test/test_all.py index d09985a81..af732c863 100644 --- a/v2/test/test_all.py +++ b/v2/test/test_all.py @@ -26,21 +26,28 @@ def run_tests(critical_tests, other_tests): invocation_dir = os.getcwd() + failures_count = 0 for i in all_tests: print ("%-25s : " %(i)), try: __import__(i) except: print "FAILED" - f = open(os.path.join(invocation_dir, 'test_results.txt'), 'w') - f.write(i) - f.close() - raise + if failures_count == 0: + f = open(os.path.join(invocation_dir, 'test_results.txt'), 'w') + f.write(i) + f.close() + failures_count = failures_count + 1 + # Restore the current directory, which might be changed by the + # test + os.chdir(invocation_dir) + continue print "PASSED" sys.stdout.flush() # makes testing under emacs more entertaining. # Erase the file on success - open('test_results.txt', 'w') + if failures_count == 0: + open('test_results.txt', 'w') def last_failed_test():