Bladeren bron

HUE-7248 [adls] Fix test_remove and splitpath()

jdesjean 8 jaren geleden
bovenliggende
commit
42786d5
2 gewijzigde bestanden met toevoegingen van 6 en 4 verwijderingen
  1. 3 3
      apps/filebrowser/src/filebrowser/views_test.py
  2. 3 1
      desktop/core/src/desktop/lib/fs/__init__.py

+ 3 - 3
apps/filebrowser/src/filebrowser/views_test.py

@@ -85,9 +85,9 @@ class TestFileBrowserWithHadoop(object):
   def test_remove(self):
     prefix = self.prefix + '/test-delete'
 
-    PATH_1 = '/%s/1' % prefix
-    PATH_2 = '/%s/2' % prefix
-    PATH_3 = '/%s/3' % prefix
+    PATH_1 = '%s/1' % prefix
+    PATH_2 = '%s/2' % prefix
+    PATH_3 = '%s/3' % prefix
     self.cluster.fs.mkdir(prefix)
     self.cluster.fs.mkdir(PATH_1)
     self.cluster.fs.mkdir(PATH_2)

+ 3 - 1
desktop/core/src/desktop/lib/fs/__init__.py

@@ -26,8 +26,10 @@ def splitpath(path):
   split = urlparse.urlparse(path)
   if split.scheme and split.netloc:
     parts = [split.scheme + '://', split.netloc] + split.path.split('/')
-  elif split.scheme:
+  elif split.scheme and split.path:
     parts = [split.scheme + ':/'] + split.path.split('/')
+  elif split.scheme:
+    parts = [split.scheme + ("://" if path.find("://") >= 0 else ":/")]
   else:
     parts = ['/'] + posixpath.normpath(path).split('/')
   # Filter empty parts out