Exemplo n.º 1
0
 def test_saving_each_step(self):
     for proc_class in test_utils.TEST_PROCESSES:
         proc = proc_class()
         saver = test_utils.ProcessSaver(proc)
         saver.capture()
         self.assertEqual(proc.state, ProcessState.FINISHED)
         self.assertTrue(
             test_utils.check_process_against_snapshots(
                 self.loop, proc_class, saver.snapshots))
Exemplo n.º 2
0
    def test_saving_each_step_interleaved(self):
        for ProcClass in test_utils.TEST_PROCESSES:
            proc = ProcClass()
            saver = test_utils.ProcessSaver(proc)
            saver.capture()

            self.assertTrue(
                test_utils.check_process_against_snapshots(
                    self.loop, ProcClass, saver.snapshots))
Exemplo n.º 3
0
    def test_instance_state_with_outputs(self):
        proc = test_utils.DummyProcessWithOutput()

        saver = test_utils.ProcessSaver(proc)
        proc.execute()

        self._check_round_trip(proc)

        for bundle, outputs in zip(saver.snapshots, saver.outputs):
            # Check that it is a copy
            self.assertIsNot(outputs, bundle.get(BundleKeys.OUTPUTS, {}))
            # Check the contents are the same
            self.assertDictEqual(outputs, bundle.get(BundleKeys.OUTPUTS, {}))

        self.assertIsNot(proc.outputs,
                         saver.snapshots[-1].get(BundleKeys.OUTPUTS, {}))