[tor-commits] [stem/master] Integ tests used line wrapped content

atagar at torproject.org atagar at torproject.org
Sun Dec 6 21:57:12 UTC 2015


commit b5200a69c29519cc57166c18c8cdc2b054a99c9a
Author: Damian Johnson <atagar at torproject.org>
Date:   Sat Dec 5 15:22:53 2015 -0800

    Integ tests used line wrapped content
    
    Oops, we invoke 'man' in two separate spots - in our manual and the integ
    tests. Our earlier changed to avoid line wrapping tweaked the command used
    by the former but not the later.
---
 stem/manual.py       |    2 +-
 test/integ/manual.py |    7 +++----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/stem/manual.py b/stem/manual.py
index a1ce395..c55d72c 100644
--- a/stem/manual.py
+++ b/stem/manual.py
@@ -422,7 +422,7 @@ def _get_categories(content):
   if content and 'TOR(1)' in content[0]:
     content = content[1:]
 
-  if content and 'TOR(1)' in content[-1]:
+  if content and content[-1].startswith('Tor'):
     content = content[:-1]
 
   categories = {}
diff --git a/test/integ/manual.py b/test/integ/manual.py
index d3fb19d..573ee2f 100644
--- a/test/integ/manual.py
+++ b/test/integ/manual.py
@@ -104,7 +104,7 @@ class TestManual(unittest.TestCase):
           stem.manual.download_man_page(file_handle = tmp)
           self.man_path = tmp.name
 
-        self.man_content = stem.util.system.call('man -P cat %s' % self.man_path)
+        self.man_content = stem.util.system.call('man --encoding=ascii -P cat %s' % self.man_path, env = {'MANWIDTH': '10000000'})
       except Exception as exc:
         self.download_error = 'Unable to download the man page: %s' % exc
 
@@ -259,8 +259,8 @@ class TestManual(unittest.TestCase):
     categories = stem.manual._get_categories(self.man_content)
 
     present = set(categories.keys())
-    missing_categories = present.difference(EXPECTED_CATEGORIES)
-    extra_categories = EXPECTED_CATEGORIES.difference(present)
+    missing_categories = EXPECTED_CATEGORIES.difference(present)
+    extra_categories = present.difference(EXPECTED_CATEGORIES)
 
     if missing_categories:
       self.fail("Changed tor's man page? We expected the %s man page sections but they're no longer around. Might need to update our Manual class." % ', '.join(missing_categories))
@@ -269,7 +269,6 @@ class TestManual(unittest.TestCase):
 
     self.assertEqual(['tor - The second-generation onion router'], categories['NAME'])
     self.assertEqual(['tor [OPTION value]...'], categories['SYNOPSIS'])
-    self.assertTrue(len(categories['DESCRIPTION']) > 5)  # check parsing of multi-line entries
 
   def test_has_all_summaries(self):
     """





More information about the tor-commits mailing list