Ejemplo n.º 1
0
    def test_saving_each_step(self):
        for proc_class in TEST_WAITING_PROCESSES:
            proc = proc_class()
            saver = ProcessSaver(proc)
            saver.capture()

            self.assertTrue(
                check_process_against_snapshots(self.loop, proc_class,
                                                saver.snapshots))
Ejemplo n.º 2
0
    def test_instance_state(self):
        proc = ThreeSteps()
        proc.play()
        wl = ProcessSaver(proc)
        proc.execute()

        for bundle, outputs in zip(wl.snapshots, wl.outputs):
            self.assertEqual(outputs, bundle['_outputs'])
Ejemplo n.º 3
0
    def test_instance_state(self):
        proc = TwoCheckpoint.new()
        wl = ProcessSaver(proc)
        proc.play()

        for snapshot, outputs in zip(wl.snapshots, wl.outputs):
            state, bundle = snapshot
            self.assertEqual(
                outputs, bundle[Process.BundleKeys.OUTPUTS.value].get_dict())
Ejemplo n.º 4
0
    def test_saving_each_step(self):
        for ProcClass in TEST_PROCESSES:
            proc = ProcClass.new()

            saver = ProcessSaver(proc)
            proc.play()

            self.assertEqual(proc.state, ProcessState.STOPPED)
            self.assertTrue(
                check_process_against_snapshots(ProcClass, saver.snapshots))
Ejemplo n.º 5
0
    def test_saving_each_step_interleaved(self):
        for ProcClass in TEST_PROCESSES:
            proc = ProcClass.new()
            ps = ProcessSaver(proc)
            try:
                proc.play()
            except BaseException:
                pass

            self.assertTrue(
                check_process_against_snapshots(ProcClass, ps.snapshots))
Ejemplo n.º 6
0
    def test_saving_each_step(self):
        for ProcClass in TEST_WAITING_PROCESSES:
            proc = ProcClass.new()
            saver = ProcessSaver(proc)
            try:
                proc.play()
            except BaseException:
                pass

            self.assertTrue(
                check_process_against_snapshots(ProcClass, saver.snapshots))
Ejemplo n.º 7
0
    def test_instance_state(self):
        proc = DummyProcessWithOutput.new()

        saver = ProcessSaver(proc)
        proc.play()

        for info, outputs in zip(saver.snapshots, saver.outputs):
            state, bundle = info
            # Check that it is a copy
            self.assertIsNot(
                outputs, bundle[Process.BundleKeys.OUTPUTS.value].get_dict())
            # Check the contents are the same
            self.assertEqual(
                outputs, bundle[Process.BundleKeys.OUTPUTS.value].get_dict())

        self.assertIsNot(
            proc.outputs,
            saver.snapshots[-1][1][Process.BundleKeys.OUTPUTS.value])