From 6b8f8f53d7110e27bc44f0d50b8b3155155932f6 Mon Sep 17 00:00:00 2001 From: maheshgudi Date: Fri, 6 Jan 2017 14:43:06 +0530 Subject: added hook evaluator type tuple in forms and fixed limit=0 mistake in grader --- yaksh/forms.py | 7 +++++-- yaksh/grader.py | 2 +- yaksh/hook_evaluator.py | 5 +---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/yaksh/forms.py b/yaksh/forms.py index 1d18d29..8a90dee 100644 --- a/yaksh/forms.py +++ b/yaksh/forms.py @@ -1,6 +1,7 @@ from django import forms from yaksh.models import get_model_class, Profile, Quiz, Question, TestCase, Course,\ - QuestionPaper, StandardTestCase, StdIOBasedTestCase + QuestionPaper, StandardTestCase, StdIOBasedTestCase, \ + HookTestCase from django.contrib.auth import authenticate from django.contrib.auth.models import User from django.contrib.contenttypes.models import ContentType @@ -40,7 +41,8 @@ test_case_types = ( ("standardtestcase", "Standard Testcase"), ("stdiobasedtestcase", "StdIO Based Testcase"), ("mcqtestcase", "MCQ Testcase"), - ) + ("hooktestcase", "Hook Testcase"), + ) UNAME_CHARS = letters + "._" + digits PWD_CHARS = letters + punctuation + digits @@ -296,3 +298,4 @@ class QuestionPaperForm(forms.ModelForm): class Meta: model = QuestionPaper fields = ['shuffle_questions'] + diff --git a/yaksh/grader.py b/yaksh/grader.py index 1d4e61e..a9a3738 100644 --- a/yaksh/grader.py +++ b/yaksh/grader.py @@ -156,7 +156,7 @@ class Grader(object): except TimeoutException: error.append(self.timeout_msg) except OSError: - msg = traceback.format_exc() + msg = traceback.format_exc(limit=0) error.append("Error: {0}".format(msg)) except Exception: exc_type, exc_value, exc_tb = sys.exc_info() diff --git a/yaksh/hook_evaluator.py b/yaksh/hook_evaluator.py index 0ccdd5e..6c8b2c3 100644 --- a/yaksh/hook_evaluator.py +++ b/yaksh/hook_evaluator.py @@ -3,8 +3,6 @@ from __future__ import unicode_literals import sys import traceback import os -from os.path import join -import importlib # Local imports from .file_utils import copy_files, delete_files @@ -14,7 +12,6 @@ from .grader import TimeoutException class HookEvaluator(BaseEvaluator): def __init__(self, metadata, test_case_data): - self.exec_scope = None self.files = [] # Set metadata values @@ -62,7 +59,7 @@ class HookEvaluator(BaseEvaluator): raise except Exception: msg = traceback.format_exc(limit=0) - err = "Error in Test case: {0}".format(msg) + err = "Error in Hook code: {0}".format(msg) del tb return success, err, mark_fraction \ No newline at end of file -- cgit