def dump(self, result_storage):
# The 'tainted' attribute is automatically set to 'True'
# if the dataset required for an answer test is missing
# (see can_run_ds() and can_run_sim()).
# This logic check prevents creating a shelve with empty answers.
storage_is_tainted = result_storage.get('tainted', False)
if self.answer_name is None or storage_is_tainted:
return
# Store data using shelve
ds = shelve.open(self.answer_name, protocol=-1)
for ds_name in result_storage:
answer_name = "%s" % ds_name
if answer_name in ds:
mylog.info("Overwriting %s", answer_name)
ds[answer_name] = result_storage[ds_name]
ds.close()
评论列表
文章目录