def before_registration(cls): r"""Operations that should be performed to modify class attributes prior to registration including things like platform dependent properties and checking environment variables for default settings. """ if platform._is_win and ('-nodisplay' in cls.default_interpreter_flags): cls.default_interpreter_flags.remove('-nodisplay') InterpretedModelDriver.before_registration(cls)
def test_ModelDriver_implementation(): r"""Test that NotImplementedError raised for base class.""" with pytest.raises(NotImplementedError): ModelDriver.language_executable() with pytest.raises(NotImplementedError): ModelDriver.executable_command(None) with pytest.raises(NotImplementedError): ModelDriver.is_library_installed(None) with pytest.raises(NotImplementedError): CompiledModelDriver.get_tool('compiler') with pytest.raises(NotImplementedError): InterpretedModelDriver.get_interpreter()
def after_registration(cls, **kwargs): r"""Operations that should be performed to modify class attributes after registration. For compiled languages this includes selecting the default compiler. The order of precedence is the config file 'compiler' option for the language, followed by the environment variable set by _compiler_env, followed by the existing class attribute. """ if platform._is_mac: cls._executable_search_dirs = [ os.path.join(x, 'bin') for x in glob.glob('/Applications/MATLAB*')] InterpretedModelDriver.after_registration(cls, **kwargs)
def finalize_registration(cls): r"""Operations that should be performed after a class has been fully initialized and registered.""" cls.supported_comms = tools.get_supported_comm() InterpretedModelDriver.finalize_registration(cls)