Bug 1452864 - [mozfile] Always use Unicode delimiters for tree() output. r=gbrown
authorHenrik Skupin <mail@hskupin.info>
Tue, 10 Apr 2018 10:22:27 +0200
changeset 412605 4c4719645fd9a93150e65911e5ed14ec1727e4e7
parent 412604 62fb6111910a0b868eaa6e8368d6d02290032a09
child 412606 bb1d1bcb3e0683a4b05b2270717d8432e490cc66
push id33813
push userccoroiu@mozilla.com
push dateTue, 10 Apr 2018 21:54:55 +0000
treeherdermozilla-central@d42671c2e69d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgbrown
bugs1452864
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1452864 - [mozfile] Always use Unicode delimiters for tree() output. r=gbrown MozReview-Commit-ID: E44O1NGM7Mg
testing/mozbase/mozfile/mozfile/mozfile.py
testing/mozbase/mozprofile/tests/test_profile_view.py
--- a/testing/mozbase/mozfile/mozfile/mozfile.py
+++ b/testing/mozbase/mozfile/mozfile/mozfile.py
@@ -247,39 +247,21 @@ def depth(directory):
     while True:
         directory, remainder = os.path.split(directory)
         level += 1
         if not remainder:
             break
     return level
 
 
-# ASCII delimeters
-ascii_delimeters = {
-    'vertical_line': '|',
-    'item_marker': '+',
-    'last_child': '\\'
-}
-
-# unicode delimiters
-unicode_delimeters = {
-    'vertical_line': u'│',
-    'item_marker': u'├',
-    'last_child': u'└'
-}
-
-
-def tree(directory,
-         item_marker=unicode_delimeters['item_marker'],
-         vertical_line=unicode_delimeters['vertical_line'],
-         last_child=unicode_delimeters['last_child'],
-         sort_key=lambda x: x.lower()):
-    """
-    display tree directory structure for `directory`
-    """
+def tree(directory, sort_key=lambda x: x.lower()):
+    """Display tree directory structure for `directory`."""
+    vertical_line = u'│'
+    item_marker = u'├'
+    last_child = u'└'
 
     retval = []
     indent = []
     last = {}
     top = depth(directory)
 
     for dirpath, dirnames, filenames in os.walk(directory, topdown=True):
 
--- a/testing/mozbase/mozprofile/tests/test_profile_view.py
+++ b/testing/mozbase/mozprofile/tests/test_profile_view.py
@@ -42,17 +42,17 @@ class TestProfilePrint(unittest.TestCase
         except BaseException:
             raise
         finally:
             mozfile.rmtree(tempdir)
 
     def test_str_cast(self):
         """Test casting to a string."""
         profile = mozprofile.Profile()
-        self.assertEqual(str(profile), profile.summary().encode("UTF-8"))
+        self.assertEqual(str(profile), profile.summary().encode("utf-8"))
 
     def test_unicode_cast(self):
         """Test casting to a unicode string."""
         profile = mozprofile.Profile()
         self.assertEqual(unicode(profile), profile.summary())
 
     def test_profile_diff(self):
         profile1 = mozprofile.Profile()