summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)