Commit b76adb4b by Will Daly

Updated tests to address on-going randomization bug.

Capa problem state was not being copied to module state
during module initialization.
This meant that when check_problem was called the first time,
the seed would be re-generated and saved.
parent 4322b838
......@@ -171,7 +171,9 @@ class CapaModule(CapaFields, XModule):
# add extra info and raise
raise Exception(msg), None, sys.exc_info()[2]
self.set_state_from_lcp()
# Ensure that the module state matches the state of the
# capa problem
self.set_state_from_lcp()
def new_lcp(self, state, text=None):
if text is None:
......
......@@ -868,9 +868,7 @@ class CapaModuleTest(unittest.TestCase):
module = CapaFactory.create(rerandomize=rerandomize)
# Get the seed
# module.seed isn't set until the problem is checked/saved,
# so we access the capa problem seed directly
seed = module.lcp.seed
seed = module.seed
self.assertTrue(seed is not None)
# If we're not rerandomizing, the seed is always set
......@@ -930,9 +928,7 @@ class CapaModuleTest(unittest.TestCase):
module = CapaFactory.create(rerandomize=rerandomize)
# Get the seed
# module.seed isn't set until we check/save/reset the problem,
# so we access the capa problem seed directly
seed = module.lcp.seed
seed = module.seed
# We do NOT want the seed to reset if rerandomize
# is set to 'never' -- it should still be 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment