def setup_iteration_language(self, language=None): r"""Perform setup associated with a language iteration.""" if language is not None: for x in get_example_languages(self.example_name, language=language): check_enabled_languages(x) return language
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(self): r"""Run the integration.""" if not tools.check_environ_bool('YGG_ENABLE_DEMO_TESTS'): raise unittest.SkipTest("Demo tests not enabled.") for x in self.languages: check_enabled_languages(x) if not tools.is_lang_installed(x): raise unittest.SkipTest("%s not installed." % x) self.runner = runner.get_runner(self.yamls, namespace=self.name, production_run=True) self.runner.run() assert (not self.runner.error_flag) self.runner = None
def setup(self, *args, **kwargs): if self.import_cls.language is None: raise unittest.SkipTest("Driver dosn't have language.") if not self.import_cls.is_installed(): if not self.__class__._flag_tests_on_not_installed: if not self.skip_init: self.assert_raises(RuntimeError, super(TestModelParam, self).setup, *args, **kwargs) self.tests_on_not_installed() self.__class__._flag_tests_on_not_installed = True raise unittest.SkipTest("'%s' not installed." % self.import_cls.language) check_enabled_languages(self.import_cls.language) super(TestModelParam, self).setup(*args, **kwargs)
def run_iteration(self, language=None, datatype=None, comm=None): r"""Run a test for the specified parameters.""" if not tools.check_environ_bool('YGG_ENABLE_EXAMPLE_TESTS'): raise unittest.SkipTest("Example tests not enabled.") if comm and (not tools.is_comm_installed(comm)): raise unittest.SkipTest("%s library not installed." % comm) if language is not None: check_enabled_languages(language) self.language = language self.datatype = datatype if comm is None: self.comm = _default_comm else: self.comm = comm self.set_default_comm(default_comm=comm) try: self.run_example() finally: self.language = None self.datatype = None self.comm = None self.reset_default_comm()
def setup_iteration_language(self, language=None): r"""Perform setup associated with a language iteration.""" if language is not None: check_enabled_languages(language) return language