@@ -84,7 +84,7 @@ def run_tests_1(test_labels, *args, **kwargs):
8484 settings .SITE_ID = 1
8585 assert (not settings .IDTRACKER_BASE_URL .endswith ('/' ))
8686 kwargs ["verbosity" ] = 0
87- django_run_tests (test_labels , * args , ** kwargs )
87+ return django_run_tests (test_labels , * args , ** kwargs )
8888
8989def run_tests (* args , ** kwargs ):
9090 # Tests that involve switching back and forth between the real
@@ -93,5 +93,20 @@ def run_tests(*args, **kwargs):
9393 if socket .gethostname ().split ('.' )[0 ] in ['core3' , 'ietfa' , 'ietfb' , 'ietfc' , ]:
9494 raise EnvironmentError ("Refusing to run tests on production server" )
9595 ietf .utils .mail .test_mode = True
96- run_tests_1 (* args , ** kwargs )
97-
96+ failures = run_tests_1 (* args , ** kwargs )
97+ # Record the test result in a file, in order to be able to check the
98+ # results and avoid re-running tests if we've alread run them with OK
99+ # result after the latest code changes:
100+ import os , time , ietf .settings as config
101+ topdir = os .path .dirname (os .path .dirname (config .__file__ ))
102+ tfile = open (os .path .join (topdir ,"testresult" ), "a" )
103+ timestr = time .strftime ("%Y-%m-%d %H:%M:%S" )
104+ if failures :
105+ tfile .write ("%s FAILED (failures=%s)\n " % (timestr , failures ))
106+ else :
107+ if args :
108+ tfile .write ("%s SUCCESS (tests=%s)\n " % (timestr , repr (list (* args ))))
109+ else :
110+ tfile .write ("%s OK\n " % (timestr , ))
111+ tfile .close ()
112+ return failures
0 commit comments