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,6 +171,8 @@ class CapaModule(CapaFields, XModule): ...@@ -171,6 +171,8 @@ class CapaModule(CapaFields, XModule):
# add extra info and raise # add extra info and raise
raise Exception(msg), None, sys.exc_info()[2] raise Exception(msg), None, sys.exc_info()[2]
# Ensure that the module state matches the state of the
# capa problem
self.set_state_from_lcp() self.set_state_from_lcp()
def new_lcp(self, state, text=None): def new_lcp(self, state, text=None):
......
...@@ -868,9 +868,7 @@ class CapaModuleTest(unittest.TestCase): ...@@ -868,9 +868,7 @@ class CapaModuleTest(unittest.TestCase):
module = CapaFactory.create(rerandomize=rerandomize) module = CapaFactory.create(rerandomize=rerandomize)
# Get the seed # Get the seed
# module.seed isn't set until the problem is checked/saved, seed = module.seed
# so we access the capa problem seed directly
seed = module.lcp.seed
self.assertTrue(seed is not None) self.assertTrue(seed is not None)
# If we're not rerandomizing, the seed is always set # If we're not rerandomizing, the seed is always set
...@@ -930,9 +928,7 @@ class CapaModuleTest(unittest.TestCase): ...@@ -930,9 +928,7 @@ class CapaModuleTest(unittest.TestCase):
module = CapaFactory.create(rerandomize=rerandomize) module = CapaFactory.create(rerandomize=rerandomize)
# Get the seed # Get the seed
# module.seed isn't set until we check/save/reset the problem, seed = module.seed
# so we access the capa problem seed directly
seed = module.lcp.seed
# We do NOT want the seed to reset if rerandomize # We do NOT want the seed to reset if rerandomize
# is set to 'never' -- it should still be 1 # 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