swig-py: tests: Fix a wrong handling of internal path.
* subversion/bindings/swig/python/tests/fs.py
(_svn_path_join_internal): New function.
(_get_dir_entries): Use _svn_path_join_internal instead of os.path.join.
@@ -61,6 +61,27 @@ def svn_test__set_file_contents(root, path, contents):
def svn_test__get_file_contents(root, path):
return svn_test__stream_to_string(fs.file_contents(root, path))
+
+def _svn_path_join_internal(base, component):
+ """Join a base path (base) with a component (component), in str"""
+
+ # If the component is absolute, then return it.
+ if component[0:1] == '/':
+ return component
+ # If either is empty return the other
+ if base == '':
+ return component
+ if component == '':
+ return base
+
+ if base == '/':
+ # Ignore base, just return separator + component
+ return '/' + component
+
+ # Construnct the new, combined path.
+ return base + '/' + component
+
+
def _get_dir_entries(root, path, tree_entries=None):
if tree_entries is None:
tree_entries = {}
@@ -77,9 +98,7 @@ def _get_dir_entries(root, path, tree_entries=None):
name = dirent.name
if not isinstance(name, str):
name = name.decode('utf-8')
- full_path = os.path.join(path, name)
- if not isinstance(full_path, str):
- full_path = full_path.decode('utf-8')
+ full_path = _svn_path_join_internal(path, name)
# Now, copy this dirent to the master hash, but this time, use
# the full path for the key
