예제 #1
0
 def test_windows_short_path_directory(self):
     if platform.system() != 'Windows':
         return
     original_path = os.path.join(TMPDIR, 'new path')
     os.makedirs(original_path, exist_ok=True)
     assert os.path.exists(original_path)
     assert ' ' in original_path
     short_path = windows_short_path(original_path)
     assert os.path.exists(short_path)
     assert original_path != short_path
     assert ' ' not in short_path
예제 #2
0
 def test_windows_short_path_file_with_space(self):
     """Test that the function doesn't touch filename."""
     if platform.system() != 'Windows':
         return
     original_path = os.path.join(TMPDIR, 'new path', 'my file.csv')
     os.makedirs(os.path.split(original_path)[0], exist_ok=True)
     assert os.path.exists(os.path.split(original_path)[0])
     assert ' ' in original_path
     short_path = windows_short_path(original_path)
     assert os.path.exists(os.path.split(short_path)[0])
     assert original_path != short_path
     assert ' ' in short_path
     assert '.csv' == os.path.splitext(short_path)[1]
예제 #3
0
 def test_windows_short_path_file(self):
     if platform.system() != 'Windows':
         return
     original_path = os.path.join(TMPDIR, 'new path', 'my_file.csv')
     os.makedirs(os.path.split(original_path)[0], exist_ok=True)
     assert os.path.exists(os.path.split(original_path)[0])
     assert ' ' in original_path
     assert '.csv' == os.path.splitext(original_path)[1]
     short_path = windows_short_path(original_path)
     assert os.path.exists(os.path.split(short_path)[0])
     assert original_path != short_path
     assert ' ' not in short_path
     assert '.csv' == os.path.splitext(short_path)[1]
예제 #4
0
 def test_windows_short_path_directory(self):
     if platform.system() != 'Windows':
         return
     with tempfile.TemporaryDirectory(prefix="cmdstan_tests",
                                      dir=_TMPDIR) as tmpdir:
         original_path = os.path.join(tmpdir, 'new path')
         os.makedirs(original_path, exist_ok=True)
         assert os.path.exists(original_path)
         assert ' ' in original_path
         short_path = windows_short_path(original_path)
         assert os.path.exists(short_path)
         assert original_path != short_path
         assert ' ' not in short_path
예제 #5
0
 def test_windows_short_path_file_with_space(self):
     """Test that the function doesn't touch filename."""
     if platform.system() != 'Windows':
         return
     with tempfile.TemporaryDirectory(prefix="cmdstan_tests",
                                      dir=_TMPDIR) as tmpdir:
         original_path = os.path.join(tmpdir, 'new path', 'my file.csv')
         os.makedirs(os.path.split(original_path)[0], exist_ok=True)
         assert os.path.exists(os.path.split(original_path)[0])
         assert ' ' in original_path
         short_path = windows_short_path(original_path)
         assert os.path.exists(os.path.split(short_path)[0])
         assert original_path != short_path
         assert ' ' in short_path
         assert os.path.splitext(short_path)[1] == '.csv'