[Yt-svn] yt: Adding option to output to a results file.
hg at spacepope.org
hg at spacepope.org
Fri Sep 3 23:26:09 PDT 2010
hg Repository: yt
details: yt/rev/b217f1ee3103
changeset: 3382:b217f1ee3103
user: Matthew Turk <matthewturk at gmail.com>
date:
Fri Sep 03 23:22:26 2010 -0700
description:
Adding option to output to a results file.
diffstat:
yt/utilities/answer_testing/runner.py | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diffs (35 lines):
diff -r 0eae5b1c68d5 -r b217f1ee3103 yt/utilities/answer_testing/runner.py
--- a/yt/utilities/answer_testing/runner.py Fri Sep 03 16:33:46 2010 -0700
+++ b/yt/utilities/answer_testing/runner.py Fri Sep 03 23:22:26 2010 -0700
@@ -50,7 +50,7 @@
plot_list = []
for i,name in enumerate(sorted(test_registry)):
self.run_test(name)
- return plot_list
+ return self.passed_tests
def run_test(self, name):
# We'll also need to call the "compare" operation,
@@ -122,6 +122,9 @@
test_runner = RegressionTestRunner(name)
test_runner.run_all_tests()
+ @cmdln.option("-o", "--output", action="store",
+ help="output results to file",
+ dest="outputfile", default=None)
def do_compare(self, subcmd, opts, reference, comparison, *test_modules):
"""
${cmd_name}: Compare a reference dataset against a new dataset. The
@@ -136,7 +139,11 @@
print "Loading module %s" % (fn)
__import__(fn)
test_runner = RegressionTestRunner(comparison, reference)
- test_runner.run_all_tests()
+ results = test_runner.run_all_tests()
+ if opts.outputfile is not None:
+ f = open(str(opts.outputfile), "w")
+ for testname, success in sorted(results.items()):
+ f.write("%s %s\n" % (testname.ljust(100), success))
def run_main():
etrc = EnzoTestRunnerCommands()
More information about the yt-svn
mailing list