diff --git a/djangoapps/courseware/capa/capa_problem.py b/djangoapps/courseware/capa/capa_problem.py
index d98757d18e..e94ed41b44 100644
--- a/djangoapps/courseware/capa/capa_problem.py
+++ b/djangoapps/courseware/capa/capa_problem.py
@@ -111,7 +111,8 @@ class LoncapaProblem(object):
self.seed=struct.unpack('i', os.urandom(4))[0]
## Parse XML file
- log.info("[courseware.capa.capa_problem.lcp.init] fileobject = %s" % fileobject)
+ if hasattr(system,'DEBUG') and system.DEBUG:
+ log.info("[courseware.capa.capa_problem.lcp.init] fileobject = %s" % fileobject)
file_text = fileobject.read()
self.fileobject = fileobject # save it, so we can use for debugging information later
# Convert startouttext and endouttext to proper
diff --git a/djangoapps/courseware/capa/responsetypes.py b/djangoapps/courseware/capa/responsetypes.py
index 3809c0c526..748e37f0bd 100644
--- a/djangoapps/courseware/capa/responsetypes.py
+++ b/djangoapps/courseware/capa/responsetypes.py
@@ -405,7 +405,6 @@ def sympy_check2():
if 1:
# try to clean up message html
- log.info('unicode2html(msg) = %s' % msg)
msg = ''+msg+''
msg = msg.replace('<','<')
#msg = msg.replace('<','<')
diff --git a/djangoapps/courseware/tests.py b/djangoapps/courseware/tests.py
index fabb79e4e7..6f44cb3f7e 100644
--- a/djangoapps/courseware/tests.py
+++ b/djangoapps/courseware/tests.py
@@ -1,3 +1,10 @@
+#
+# unittests for courseware
+#
+# Note: run this using a like like this:
+#
+# django-admin.py test --settings=envs.test_ike --pythonpath=. courseware
+
import unittest
import os
@@ -127,6 +134,94 @@ class ImageResponseTest(unittest.TestCase):
self.assertEquals(test_lcp.grade_answers(test_answers)['1_2_1'], 'correct')
self.assertEquals(test_lcp.grade_answers(test_answers)['1_2_2'], 'incorrect')
+class SymbolicResponseTest(unittest.TestCase):
+ def test_sr_grade(self):
+ symbolicresponse_file = os.path.dirname(__file__)+"/test_files/symbolicresponse.xml"
+ test_lcp = lcp.LoncapaProblem(open(symbolicresponse_file), '1', system=i4xs)
+ correct_answers = {'1_2_1':'cos(theta)*[[1,0],[0,1]] + i*sin(theta)*[[0,1],[1,0]]',
+ '1_2_1_dynamath': '''
+
+''',
+ }
+ wrong_answers = {'1_2_1':'2',
+ '1_2_1_dynamath':'''
+ ''',
+ }
+ self.assertEquals(test_lcp.grade_answers(correct_answers)['1_2_1'], 'correct')
+ self.assertEquals(test_lcp.grade_answers(wrong_answers)['1_2_1'], 'incorrect')
+
class OptionResponseTest(unittest.TestCase):
'''
Run this with
diff --git a/envs/test_ike.py b/envs/test_ike.py
new file mode 100644
index 0000000000..2d319ff281
--- /dev/null
+++ b/envs/test_ike.py
@@ -0,0 +1,89 @@
+"""
+This config file runs the simplest dev environment using sqlite, and db-based
+sessions. Assumes structure:
+
+/envroot/
+ /db # This is where it'll write the database file
+ /mitx # The location of this repo
+ /log # Where we're going to write log files
+"""
+from envs.common import *
+from envs.logsettings import get_logger_config
+import os
+
+DEBUG = True
+
+INSTALLED_APPS = [
+ app
+ for app
+ in INSTALLED_APPS
+ if not app.startswith('askbot')
+]
+
+# Nose Test Runner
+INSTALLED_APPS += ['django_nose']
+#NOSE_ARGS = ['--cover-erase', '--with-xunit', '--with-xcoverage', '--cover-html', '--cover-inclusive']
+NOSE_ARGS = ['--cover-erase', '--with-xunit', '--cover-html', '--cover-inclusive']
+for app in os.listdir(PROJECT_ROOT / 'djangoapps'):
+ NOSE_ARGS += ['--cover-package', app]
+TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
+
+# Local Directories
+TEST_ROOT = path("test_root")
+COURSES_ROOT = TEST_ROOT / "data"
+DATA_DIR = COURSES_ROOT
+MAKO_TEMPLATES['course'] = [DATA_DIR]
+MAKO_TEMPLATES['sections'] = [DATA_DIR / 'sections']
+MAKO_TEMPLATES['custom_tags'] = [DATA_DIR / 'custom_tags']
+MAKO_TEMPLATES['main'] = [PROJECT_ROOT / 'templates',
+ DATA_DIR / 'info',
+ DATA_DIR / 'problems']
+
+LOGGING = get_logger_config(TEST_ROOT / "log",
+ logging_env="dev",
+ tracking_filename="tracking.log",
+ debug=True)
+
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': PROJECT_ROOT / "db" / "mitx.db",
+ }
+}
+
+CACHES = {
+ # This is the cache used for most things. Askbot will not work without a
+ # functioning cache -- it relies on caching to load its settings in places.
+ # In staging/prod envs, the sessions also live here.
+ 'default': {
+ 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
+ 'LOCATION': 'mitx_loc_mem_cache',
+ 'KEY_FUNCTION': 'util.memcache.safe_key',
+ },
+
+ # The general cache is what you get if you use our util.cache. It's used for
+ # things like caching the course.xml file for different A/B test groups.
+ # We set it to be a DummyCache to force reloading of course.xml in dev.
+ # In staging environments, we would grab VERSION from data uploaded by the
+ # push process.
+ 'general': {
+ 'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
+ 'KEY_PREFIX': 'general',
+ 'VERSION': 4,
+ 'KEY_FUNCTION': 'util.memcache.safe_key',
+ }
+}
+
+# Dummy secret key for dev
+SECRET_KEY = '85920908f28904ed733fe576320db18cabd7b6cd'
+
+############################ FILE UPLOADS (ASKBOT) #############################
+DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
+MEDIA_ROOT = PROJECT_ROOT / "uploads"
+MEDIA_URL = "/static/uploads/"
+STATICFILES_DIRS.append(("uploads", MEDIA_ROOT))
+FILE_UPLOAD_TEMP_DIR = PROJECT_ROOT / "uploads"
+FILE_UPLOAD_HANDLERS = (
+ 'django.core.files.uploadhandler.MemoryFileUploadHandler',
+ 'django.core.files.uploadhandler.TemporaryFileUploadHandler',
+)
diff --git a/lib/symmath/formula.py b/lib/symmath/formula.py
index 09bcf8693d..5eba1329cb 100644
--- a/lib/symmath/formula.py
+++ b/lib/symmath/formula.py
@@ -325,7 +325,7 @@ class formula(object):
# parser tree for Content MathML
tag = gettag(xml)
- print "tag = ",tag
+ # print "tag = ",tag
# first do compound objects
diff --git a/lib/symmath/symmath_check.py b/lib/symmath/symmath_check.py
index 09621e27ca..175351b072 100644
--- a/lib/symmath/symmath_check.py
+++ b/lib/symmath/symmath_check.py
@@ -184,6 +184,8 @@ def symmath_check(expect,ans,dynamath=None,options=None,debug=None):
if dynamath:
mmlans = dynamath[0]
except Exception,err:
+ mmlans = None
+ if not mmlans:
return {'ok':False,'msg':'[symmath_check] failed to get MathML for input; dynamath=%s' % dynamath}
f = formula(mmlans,options=options)