Exemple #1
0
 def _load_controls(self):
     from openalea.core.control.serialization import ControlLoader
     from openalea.core.service.control import register_control
     control_path = self.path / 'control.py'
     loader = ControlLoader()
     controls = loader.load(control_path)
     for control in controls:
         register_control(control)
Exemple #2
0
 def _load_controls(self):
     from openalea.core.control.serialization import ControlLoader
     from openalea.core.service.control import register_control
     control_path = self.path / 'control.py'
     loader = ControlLoader()
     controls = loader.load(control_path)
     for control in controls:
         register_control(control)
Exemple #3
0
    def test_load_save(self):
        c1 = Control('a', value=1,  constraints=dict(min=1, max=2))
        c2 = Control('a', 'IStr', 'salut')
        orig = [c1, c2]

        tmp = tempdir()
        saver = ControlSaver()
        saver.save(orig, tmp / 'control.py')

        loader = ControlLoader()
        controls = loader.load(tmp / 'control.py')
        tmp.rmtree()

        assert len(controls) == len(orig)
        for i in range(len(orig)):
            self.compare_controls(orig[i], controls[i])
    def test_load_save(self):
        c1 = Control('a', value=1,  constraints=dict(min=1, max=2))
        c2 = Control('a', 'IStr', 'salut')
        orig = [c1, c2]

        tmp = tempdir()
        saver = ControlSaver()
        saver.save(orig, tmp / 'control.py')

        loader = ControlLoader()
        controls = loader.load(tmp / 'control.py')
        tmp.rmtree()

        assert len(controls) == len(orig)
        for i in range(len(orig)):
            self.compare_controls(orig[i], controls[i])