[tor-commits] [stem/master] Check that we have 'man' for tests

atagar at torproject.org atagar at torproject.org
Mon Dec 7 01:39:31 UTC 2015


commit a4fce191c843971991b482fdbb258cc4bcc18cc1
Author: Damian Johnson <atagar at torproject.org>
Date:   Sun Dec 6 15:32:30 2015 -0800

    Check that we have 'man' for tests
    
    On reflection our unit tests will now fail on Windows due to running 'man'.
    Adding a check for this.
---
 test/integ/manual.py |    4 ++--
 test/unit/manual.py  |   11 +++++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/test/integ/manual.py b/test/integ/manual.py
index c961101..53f9faf 100644
--- a/test/integ/manual.py
+++ b/test/integ/manual.py
@@ -128,8 +128,8 @@ class TestManual(unittest.TestCase):
     options. Unlike most other tests this doesn't require network access.
     """
 
-    if stem.util.system.is_windows():
-      test.runner.skip(self, '(unavailable on windows)')  # needs to run 'man'
+    if not stem.util.system.is_available('man'):
+      test.runner.skip(self, '(require man command)')
       return
 
     manual = stem.manual.Manual.from_man(os.path.join(os.path.dirname(__file__), 'tor.1_with_unknown'))
diff --git a/test/unit/manual.py b/test/unit/manual.py
index 4d9d539..bb2e2d5 100644
--- a/test/unit/manual.py
+++ b/test/unit/manual.py
@@ -9,6 +9,9 @@ import unittest
 
 import stem.prereq
 import stem.manual
+import stem.util.system
+
+import test.runner
 
 try:
   # account for urllib's change between python 2.x and 3.x
@@ -115,6 +118,10 @@ class TestManual(unittest.TestCase):
     expand our example (or add another).
     """
 
+    if not stem.util.system.is_available('man'):
+      test.runner.skip(self, '(require man command)')
+      return
+
     manual = stem.manual.Manual.from_man(EXAMPLE_MAN_PATH)
 
     self.assertEqual('tor - The second-generation onion router', manual.name)
@@ -130,6 +137,10 @@ class TestManual(unittest.TestCase):
     Check that we can save and reload manuals.
     """
 
+    if not stem.util.system.is_available('man'):
+      test.runner.skip(self, '(require man command)')
+      return
+
     manual = stem.manual.Manual.from_man(EXAMPLE_MAN_PATH)
 
     with tempfile.NamedTemporaryFile(prefix = 'saved_test_manual.') as tmp:



More information about the tor-commits mailing list