#NEWLINE# def test_get_reversed_workspaces( self ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# rootdir = tempfile . mkdtemp ( ) #NEWLINE# mock_env = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# self . assertEqual ( [ ] , _get_workspaces ( mock_env ) ) #NEWLINE# self . assertEqual ( [ ] , _get_workspaces ( mock_env , 'foo' ) ) #NEWLINE# foows = os . path . join ( rootdir , 'foo' ) #NEWLINE# os . makedirs ( foows ) #NEWLINE# with open ( os . path . join ( foows , CATKIN_MARKER_FILE ) , 'w' ) as fhand : #NEWLINE# #INDENT# fhand . write ( '' ) #NEWLINE# #UNINDENT# barws = os . path . join ( barws , 'bar' ) #NEWLINE# os . makedirs ( barws ) #NEWLINE# with open ( os . path . join ( barws , CATKIN_MARKER_FILE ) , 'w' ) as fhand : #NEWLINE# #INDENT# fhand . write ( '' ) #NEWLINE# #UNINDENT# nows = os . path . join ( rootdir , 'nows' ) #NEWLINE# os . makedirs ( nows ) #NEWLINE# mock_env = { #NEWLINE# #INDENT# 'CMAKE_PREFIX_PATH' : foows , #NEWLINE# #UNINDENT# } #NEWLINE# self . assertEqual ( [ foows ] , _get_workspaces ( mock_env ) ) #NEWLINE# mock_env = { #NEWLINE# #INDENT# 'CMAKE_PREFIX_PATH' : os . pathsep . join ( [ nows , foows , barws , 'invalid' ] ) , #NEWLINE# #UNINDENT# } #NEWLINE# self . assertEqual ( [ foows , barws ] , _get_workspaces ( mock_env ) ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# shutil . rmtree ( rootdir )