summaryrefslogtreecommitdiff
path: root/monkey/test.py
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@araneo.org>2015-01-23 15:33:13 +0100
committerAleš Smodiš <aless@guru.si>2015-08-11 14:26:01 +0200
commit03eda3425520090fb170a351c8c834a04f4c402d (patch)
tree97b63f93225c13f78b819efc96831507df23d43b /monkey/test.py
parent111867954150090addeaa1c3f2766b84d6e96437 (diff)
Move get_aux_code to tutor/models.py
Diffstat (limited to 'monkey/test.py')
-rwxr-xr-xmonkey/test.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/monkey/test.py b/monkey/test.py
index 3143274..f8264b0 100755
--- a/monkey/test.py
+++ b/monkey/test.py
@@ -19,7 +19,7 @@ from .util import indent
os.environ['DJANGO_SETTINGS_MODULE'] = 'webmonkey.settings'
django.setup()
from django.contrib.auth.models import User
-from tutor.models import Attempt, Problem
+from tutor.models import Attempt, Problem, get_aux_code
# Get problem id from commandline.
if len(sys.argv) < 2:
@@ -29,15 +29,16 @@ pid = int(sys.argv[1])
# Analyze traces for this problem to get edits, submissions and queries.
problem = Problem.objects.get(pk=pid)
-attempts = Attempt.objects.filter(problem=problem)
+aux_code = get_aux_code(user=User.objects.get(pk=1), problem=problem)
+attempts = Attempt.objects.filter(problem=problem)
traces = [a.trace for a in attempts]
edits, lines, submissions, queries = get_edits_from_traces(traces)
# Find incorrect submissions.
incorrect = []
for submission, count in sorted(submissions.items()):
- if not test(problem.name, submission):
+ if not test(problem.name, submission + '\n' + aux_code):
# This incorrect submission appeared in [count] attempts.
incorrect += [submission]*count
@@ -166,5 +167,5 @@ else:
# Try finding a fix.
print(colored('Analyzing program…', 'yellow'))
- solution, steps, fix_time, n_tested = fix(problem.name, code, edits, debug=True)
+ solution, steps, fix_time, n_tested = fix(problem.name, code, edits, aux_code=aux_code, debug=True)
print_hint(solution, steps, fix_time, n_tested)