def run_example(self): r"""This runs an example in the correct language.""" if self._new_default_comm == 'IPCComm': from yggdrasil.communication.IPCComm import ipcrm_queues, ipc_queues qlist = ipc_queues() if qlist: # pragma: debug print('Existing queues:', qlist) ipcrm_queues() super(ExampleTimedPipeTestBase, self).run_example()
def run_example(self): r"""This runs an example in the correct language.""" assert (self.yaml is not None) assert (self.name is not None) # Check that language is installed for x in self.languages_tested: if not tools.is_lang_installed(x): raise unittest.SkipTest("%s not installed." % x) check_enabled_languages(x) # Copy platform specific makefile if self.language == 'make': makefile = os.path.join(self.yamldir, 'src', 'Makefile') if platform._is_win: # pragma: windows makedrv = import_component('model', 'make') assert (makedrv.get_tool('compiler').toolname == 'nmake') make_ext = '_windows' else: make_ext = '_linux' shutil.copy(makefile + make_ext, makefile) # Check that comm is installed if self.comm in ['ipc', 'IPCComm']: from yggdrasil.communication.IPCComm import (ipcrm_queues, ipc_queues) qlist = ipc_queues() if qlist: # pragma: debug print('Existing queues:', qlist) ipcrm_queues() # Run os.environ.update(self.env) self.runner = runner.get_runner(self.yaml, namespace=self.namespace, production_run=True) self.runner.run() if self.expects_error: assert (self.runner.error_flag) else: assert (not self.runner.error_flag) try: self.check_results() except BaseException: # pragma: debug self.runner.printStatus() raise finally: self.example_cleanup() # Remove copied makefile if self.language == 'make': makefile = os.path.join(self.yamldir, 'src', 'Makefile') if os.path.isfile(makefile): os.remove(makefile) self.runner = None
def run_example(self): r"""This runs an example in the correct language.""" if self.yaml is None: if self.name is not None: raise unittest.SkipTest("Could not locate example %s in language %s." % (self.name, self.language)) else: # Copy platform specific makefile if self.language == 'make': makefile = os.path.join(self.yamldir, 'src', 'Makefile') if platform._is_win: # pragma: windows make_ext = '_windows' else: make_ext = '_linux' shutil.copy(makefile + make_ext, makefile) # Check that language is installed for x in self.languages_tested: if not tools.is_lang_installed(x): raise unittest.SkipTest("%s not installed." % x) # Check that comm is installed if self.comm in ['ipc', 'IPCComm']: from yggdrasil.communication.IPCComm import ( ipcrm_queues, ipc_queues) qlist = ipc_queues() if qlist: # pragma: debug print('Existing queues:', qlist) ipcrm_queues() # Run os.environ.update(self.env) self.runner = runner.get_runner(self.yaml, namespace=self.namespace) self.runner.run() if self.expects_error: assert(self.runner.error_flag) else: assert(not self.runner.error_flag) try: self.check_results() finally: self.cleanup() # Remove copied makefile if self.language == 'make': makefile = os.path.join(self.yamldir, 'src', 'Makefile') if os.path.isfile(makefile): os.remove(makefile)
def commtype(self, request, check_required_comms, change_default_comm, language, running_service): r"""str: Comm used by the current test.""" out = request.param if out in ['value', 'buffer', 'rmq_async']: pytest.skip("invalid commtype for integration") check_required_comms([out], language=language) with change_default_comm(out): if out == 'ipc': from yggdrasil.communication.IPCComm import (ipcrm_queues, ipc_queues) qlist = ipc_queues() if qlist: # pragma: debug print('Existing queues:', qlist) ipcrm_queues() if out == 'rest': with running_service('flask', partial_commtype='rest'): yield out else: yield out