#NEWLINE# @ in_temporary_directory #NEWLINE# def test_verb_alias_config_initialization( ) : #NEWLINE# #INDENT# cwd = os . getcwd ( ) #NEWLINE# test_folder = os . path . join ( cwd , 'test' ) #NEWLINE# with assert_raises_regexp ( RuntimeError , 'Cannot initialize verb aliases because catkin configuration path' ) : #NEWLINE# #INDENT# config . initialize_verb_aliases ( test_folder ) #NEWLINE# #UNINDENT# os . makedirs ( test_folder ) #NEWLINE# config . initialize_verb_aliases ( test_folder ) #NEWLINE# assert os . path . isdir ( test_folder ) #NEWLINE# assert os . path . isdir ( os . path . join ( test_folder , 'verb_aliases' ) ) #NEWLINE# defaults_path = os . path . join ( test_folder , 'verb_aliases' , '00-default-aliases.yaml' ) #NEWLINE# assert os . path . isfile ( defaults_path ) #NEWLINE# config . initialize_verb_aliases ( test_folder ) #NEWLINE# with open ( defaults_path , 'w' ) as f : #NEWLINE# #INDENT# f . write ( 'This should be overwritten (simulation of update needed)' ) #NEWLINE# #UNINDENT# with redirected_stdio ( ) as ( out , err ) : #NEWLINE# #INDENT# config . initialize_verb_aliases ( test_folder ) #NEWLINE# #UNINDENT# assert ( 'Warning, builtin verb aliases at' in out . getvalue ( ) ) , out . getvalue ( ) #NEWLINE# shutil . rmtree ( test_folder ) #NEWLINE# os . makedirs ( test_folder ) #NEWLINE# with open ( os . path . join ( test_folder , 'verb_aliases' ) , 'w' ) as f : #NEWLINE# #INDENT# f . write ( 'this will cause a RuntimeError' ) #NEWLINE# #UNINDENT# with assert_raises_regexp ( RuntimeError , 'The catkin verb aliases config directory' ) : #NEWLINE# #INDENT# config . initialize_verb_aliases ( test_folder ) #NEWLINE# #UNINDENT# shutil . rmtree ( test_folder )