From 878693c0f1a0a4cee1ae0478e762b4c57dc44df3 Mon Sep 17 00:00:00 2001 From: Tomas Gavenciak Date: Sat, 18 Sep 2010 23:44:09 +0200 Subject: [PATCH] Modified test.py (almost rewrite) --- t/test.py | 40 +++++++++++----------------------------- 1 file changed, 11 insertions(+), 29 deletions(-) diff --git a/t/test.py b/t/test.py index 26d1a29..15470ab 100755 --- a/t/test.py +++ b/t/test.py @@ -1,7 +1,7 @@ #!/usr/bin/env python import sys -sys.path.append('.') +#sys.path.append('.') import moe import moe.config @@ -12,33 +12,15 @@ import moe.batch import os e = moe.eval.Eval() - try: - overrides = moe.config.parse_overrides(sys.argv) - e.builtins.set("HOME", ".") - e.builtins.set("TASK", "sum") - e.builtins.set("CONTESTANT", "mj") - e.log.progress("### Evaluating task %s of contestant %s ###\n\n" % (e['TASK'], e['CONTESTANT'])) - e.init(overrides) -except moe.MoeError, err: - e.log.shout("FATAL: %s\n" % err) + e.init(['TASK = "sum"; CONTESTANT = "mj"; SOURCE = "som_sol.c"; VERBOSE = "2"'] + sys.argv[1:]) + e.log.debug("### Evaluating task %s of contestant %s ###\n\n" % (e['TASK'], e['CONTESTANT'])) + try: + e.run() + except moe.SolutionError, err: # Why are we catching this? + e.status["error"] = err + e.log.user.error(err) + e.log.exception() +except: + e.log.exception("Moe fatal error") sys.exit(1) - -try: - if len(sys.argv) > 1: - file = sys.argv[1] - else: - file = None - moe.batch.locate(e, file) - e.run() -except moe.MoeError, err: - e.log.shout("FATAL: %s\n" % err) - sys.exit(1) -except moe.SolutionError, err: - e.stat["error"] = err - e.log.shout("%s\n" % err) -except Exception: - moe.log.fatal_exception() - -moe.log.default.progress_file.write("\nFinal status file:\n") -e.stat.write(file=moe.log.default.progress_file) -- 2.39.5