def test_path_translations(): paths = [ (r";z:\miniconda\Scripts\pip.exe", ":/z/miniconda/Scripts/pip.exe", ":/cygdrive/z/miniconda/Scripts/pip.exe"), ( r";z:\miniconda;z:\Documents (x86)\pip.exe;C:\test", ":/z/miniconda:/z/Documents (x86)/pip.exe:/C/test", ":/cygdrive/z/miniconda:/cygdrive/z/Documents (x86)/pip.exe:/cygdrive/C/test", ), # Failures: # (r"z:\miniconda\Scripts\pip.exe", # "/z/miniconda/Scripts/pip.exe", # "/cygdrive/z/miniconda/Scripts/pip.exe"), # ("z:\\miniconda\\", # "/z/miniconda/", # "/cygdrive/z/miniconda/"), ( "test dummy text /usr/bin;z:\\documents (x86)\\code\\conda\\tests\\envskhkzts\\test1;z:\\documents\\code\\conda\\tests\\envskhkzts\\test1\\cmd more dummy text", "test dummy text /usr/bin:/z/documents (x86)/code/conda/tests/envskhkzts/test1:/z/documents/code/conda/tests/envskhkzts/test1/cmd more dummy text", "test dummy text /usr/bin:/cygdrive/z/documents (x86)/code/conda/tests/envskhkzts/test1:/cygdrive/z/documents/code/conda/tests/envskhkzts/test1/cmd more dummy text", ), ] for windows_path, unix_path, cygwin_path in paths: assert utils.win_path_to_unix(windows_path) == unix_path assert utils.unix_path_to_win(unix_path) == windows_path assert utils.win_path_to_cygwin(windows_path) == cygwin_path assert utils.cygwin_path_to_win(cygwin_path) == windows_path
def test_path_translations(): paths = [ (r";z:\miniconda\Scripts\pip.exe", ":/z/miniconda/Scripts/pip.exe", ":/cygdrive/z/miniconda/Scripts/pip.exe"), (r";z:\miniconda;z:\Documents (x86)\pip.exe;C:\test", ":/z/miniconda:/z/Documents (x86)/pip.exe:/C/test", ":/cygdrive/z/miniconda:/cygdrive/z/Documents (x86)/pip.exe:/cygdrive/C/test" ), # Failures: # (r"z:\miniconda\Scripts\pip.exe", # "/z/miniconda/Scripts/pip.exe", # "/cygdrive/z/miniconda/Scripts/pip.exe"), # ("z:\\miniconda\\", # "/z/miniconda/", # "/cygdrive/z/miniconda/"), ("test dummy text /usr/bin;z:\\documents (x86)\\code\\conda\\tests\\envskhkzts\\test1;z:\\documents\\code\\conda\\tests\\envskhkzts\\test1\\cmd more dummy text", "test dummy text /usr/bin:/z/documents (x86)/code/conda/tests/envskhkzts/test1:/z/documents/code/conda/tests/envskhkzts/test1/cmd more dummy text", "test dummy text /usr/bin:/cygdrive/z/documents (x86)/code/conda/tests/envskhkzts/test1:/cygdrive/z/documents/code/conda/tests/envskhkzts/test1/cmd more dummy text" ), ] for windows_path, unix_path, cygwin_path in paths: assert win_path_to_unix(windows_path) == unix_path assert utils.unix_path_to_win(unix_path) == windows_path assert utils.win_path_to_cygwin(windows_path) == cygwin_path assert utils.cygwin_path_to_win(cygwin_path) == windows_path
def test_path_translation(): test_cygwin_path = "test dummy text /usr/bin:/cygdrive/z/documents (x86)/code/conda/tests/envskhkzts/test1:/cygdrive/z/documents/code/conda/tests/envskhkzts/test1/cmd more dummy text" test_unix_path = "test dummy text /usr/bin:/z/documents (x86)/code/conda/tests/envskhkzts/test1:/z/documents/code/conda/tests/envskhkzts/test1/cmd more dummy text" test_win_path = "test dummy text /usr/bin;z:\\documents (x86)\\code\\conda\\tests\\envskhkzts\\test1;z:\\documents\\code\\conda\\tests\\envskhkzts\\test1\\cmd more dummy text" assert_equals(test_win_path, unix_path_to_win(test_unix_path)) assert_equals(test_unix_path, win_path_to_unix(test_win_path)) assert_equals(test_cygwin_path, win_path_to_cygwin(test_win_path)) assert_equals(test_win_path, cygwin_path_to_win(test_cygwin_path))
def test_path_translations(): paths = [ (r";z:\miniconda\Scripts\pip.exe", ":/z/miniconda/Scripts/pip.exe", ":/cygdrive/z/miniconda/Scripts/pip.exe"), (r";z:\miniconda;z:\Documents (x86)\pip.exe;C:\test", ":/z/miniconda:/z/Documents (x86)/pip.exe:/C/test", ":/cygdrive/z/miniconda:/cygdrive/z/Documents (x86)/pip.exe:/cygdrive/C/test"), # Failures: # (r"z:\miniconda\Scripts\pip.exe", # "/z/miniconda/Scripts/pip.exe", # "/cygdrive/z/miniconda/Scripts/pip.exe"), # ("z:\\miniconda\\", # "/z/miniconda/", # "/cygdrive/z/miniconda/"), ("test dummy text /usr/bin;z:\\documents (x86)\\code\\conda\\tests\\envskhkzts\\test1;z:\\documents\\code\\conda\\tests\\envskhkzts\\test1\\cmd more dummy text", "test dummy text /usr/bin:/z/documents (x86)/code/conda/tests/envskhkzts/test1:/z/documents/code/conda/tests/envskhkzts/test1/cmd more dummy text", "test dummy text /usr/bin:/cygdrive/z/documents (x86)/code/conda/tests/envskhkzts/test1:/cygdrive/z/documents/code/conda/tests/envskhkzts/test1/cmd more dummy text"), ] for windows_path, unix_path, cygwin_path in paths: win2unix = utils.win_path_to_unix(windows_path) unix2win = utils.unix_path_to_win(unix_path) win2cygwin = utils.win_path_to_cygwin(windows_path) cygwin2win = utils.cygwin_path_to_win(cygwin_path) print("win2unix == unix_path :: {} == {} :: {}".format( win2unix, unix_path, win2unix == unix_path)) print("unix2win == windows_path :: {} == {} :: {}".format( unix2win, windows_path, unix2win == windows_path)) print("win2cygwin == cygwin_path :: {} == {} :: {}".format( win2cygwin, cygwin_path, win2cygwin == cygwin_path)) print("cygwin2win == windows_path :: {} == {} :: {}".format( cygwin2win, windows_path, cygwin2win == windows_path)) assert win2unix == unix_path assert unix2win == windows_path assert win2cygwin == cygwin_path assert cygwin2win == windows_path