Skip to content

Commit 97a7ab3

Browse files
committed
Added simple logging of test runs, to make it easier to be sure that tests has been run successfully on the latest code.
- Legacy-Id: 5131
1 parent 83f7b4c commit 97a7ab3

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

ietf/utils/test_runner.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

8989
def 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

Comments
 (0)