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.
This commit is contained in:
Will Daly
2013-04-01 11:22:42 -04:00
parent 4322b83894
commit b76adb4b06
2 changed files with 5 additions and 7 deletions

View File

@@ -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:

View File

@@ -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