#NEWLINE# def user_cd( cmd , **kwargs ) : #NEWLINE# #INDENT# "\n    Used in system tests to emulate a user changing directories\n\n    Used in place of user('cd <new_directory>')\n    " #NEWLINE# if ( type ( cmd ) is str ) : #NEWLINE# #INDENT# assert ( cmd is not '' ) , 'no arguments passed to cd, not allowed' #NEWLINE# cmd = cmd . split ( ) #NEWLINE# #UNINDENT# new_directory = cmd [ 0 ] #NEWLINE# assert os . path . exists ( new_directory ) , ( ( "user tried to cd to '" + new_directory ) + "' which does not exist" ) #NEWLINE# os . chdir ( new_directory ) #NEWLINE# return 0