summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoradityacp2018-04-06 16:21:12 +0530
committeradityacp2018-04-06 16:53:01 +0530
commita3e540aa209be57318de6c3e2548c56e68fdeded (patch)
tree1db29481917b56f7c0c1d5d8c7b02536e876d1e6
parentc9aeb7b7e1484229782f0f8ab397890b27cfc905 (diff)
downloadonline_test-a3e540aa209be57318de6c3e2548c56e68fdeded.tar.gz
online_test-a3e540aa209be57318de6c3e2548c56e68fdeded.tar.bz2
online_test-a3e540aa209be57318de6c3e2548c56e68fdeded.zip
Change in grader.py and python_assertion_evaluator.py
- Make pep8 change in grader.py - Add nose tools in the scope during check_code instead of compile_code
-rw-r--r--yaksh/grader.py3
-rw-r--r--yaksh/python_assertion_evaluator.py2
2 files changed, 3 insertions, 2 deletions
diff --git a/yaksh/grader.py b/yaksh/grader.py
index d81470b..9bc4e5c 100644
--- a/yaksh/grader.py
+++ b/yaksh/grader.py
@@ -156,7 +156,8 @@ class Grader(object):
del tb_list[1:3]
error.append(
prettify_exceptions(
- exc_type.__name__, str(exc_value), "".join(tb_list), line_no=line_no
+ exc_type.__name__, str(exc_value), "".join(tb_list),
+ line_no=line_no
)
)
finally:
diff --git a/yaksh/python_assertion_evaluator.py b/yaksh/python_assertion_evaluator.py
index 1f2b82b..4b016a1 100644
--- a/yaksh/python_assertion_evaluator.py
+++ b/yaksh/python_assertion_evaluator.py
@@ -39,7 +39,6 @@ class PythonAssertionEvaluator(BaseEvaluator):
submitted = compile(self.user_answer, '<string>', mode='exec')
self.exec_scope = {}
exec(submitted, self.exec_scope)
- exec("from nose.tools import *", self.exec_scope)
return self.exec_scope
def check_code(self):
@@ -67,6 +66,7 @@ class PythonAssertionEvaluator(BaseEvaluator):
success = False
mark_fraction = 0.0
try:
+ exec("from nose.tools import *", self.exec_scope)
_tests = compile(self.test_case, '<string>', mode='exec')
exec(_tests, self.exec_scope)
except TimeoutException: