def make_executable_script_for(self, implementation_factory): from amuse.rfi.tools.create_python_worker import CreateAPythonWorker x = CreateAPythonWorker() x.channel_type = self.channel_type x.interface_class = type(self) x.implementation_factory = implementation_factory if self.channel_factory.is_root(): x.start() return x.worker_name
def test1(self): x = CreateAPythonWorker() x.implementation_factory = ForTestingImplementation x.channel_type = 'mpi' x.interface_class = ForTestingInterface script_string = x.new_executable_script_string() self.assertTrue(script_string.find('syspath = (') > 0) self.assertTrue(script_string.find('ForTestingInterface') > 0) self.assertTrue(script_string.find('ForTestingImplementation') > 0) self.assertTrue(script_string.find('test_python_implementation') > 0) self.assertTrue(script_string.find('PythonImplementation(instance, ForTestingInterface)')>0) try: st = compile(script_string, 'test.py', 'exec') except SyntaxError, ex: self.fail("Compilation error {0}".format(ex))