[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Skip tests for Slackware systems



commit b7d101280b3e667c694a5d6753ac308aa66aa40f
Author: Edmund Wong <ewongbb@xxxxxxxxxxx>
Date:   Fri Sep 8 19:47:27 2017 +0800

    Skip tests for Slackware systems
---
 stem/manual.py      |  2 +-
 stem/util/system.py | 11 +++++++++++
 test/unit/manual.py |  7 ++++---
 3 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/stem/manual.py b/stem/manual.py
index 3440b36d..ede02faf 100644
--- a/stem/manual.py
+++ b/stem/manual.py
@@ -485,7 +485,7 @@ class Manual(object):
     :raises: **IOError** if unable to retrieve the manual
     """
 
-    man_cmd = 'man %s -P cat %s' % ('' if (stem.util.system.is_mac() or stem.util.system.is_bsd()) else '--encoding=ascii', man_path)
+    man_cmd = 'man %s -P cat %s' % ('' if (stem.util.system.is_mac() or stem.util.system.is_bsd() or stem.util.system.is_slackware()) else '--encoding=ascii', man_path)
 
     try:
       man_output = stem.util.system.call(man_cmd, env = {'MANWIDTH': '10000000'})
diff --git a/stem/util/system.py b/stem/util/system.py
index a563db45..47527795 100644
--- a/stem/util/system.py
+++ b/stem/util/system.py
@@ -22,6 +22,7 @@ best-effort, providing **None** if the lookup fails.
   is_mac - checks if we're running on a mac
   is_gentoo - checks if we're running on gentoo
   is_bsd - checks if we're running on the bsd family of operating systems
+  is_slackware - checks if we're running on slackware
 
   is_available - determines if a command is available on this system
   is_running - determines if a given process is running
@@ -351,6 +352,16 @@ def is_bsd():
   return platform.system() in ('Darwin', 'FreeBSD', 'OpenBSD')
 
 
+def is_slackware():
+  """
+  Checks if we are running on a Slackware system.
+
+  :returns: **bool** to indicate if we're on a Slackware system
+  """
+
+  return os.path.exists('/etc/slackware-version')
+
+
 def is_available(command, cached=True):
   """
   Checks the current PATH to see if a command is available or not. If more
diff --git a/test/unit/manual.py b/test/unit/manual.py
index aa8cede1..cd850af9 100644
--- a/test/unit/manual.py
+++ b/test/unit/manual.py
@@ -153,7 +153,7 @@ class TestManual(unittest.TestCase):
     expand our example (or add another).
     """
 
-    if stem.util.system.is_mac() or stem.util.system.is_bsd():
+    if stem.util.system.is_mac() or stem.util.system.is_bsd() or stem.util.system.is_slackware():
       self.skipTest('(man lacks --encoding arg on OSX and BSD, #18660)')
       return
 
@@ -174,8 +174,8 @@ class TestManual(unittest.TestCase):
     options. Unlike most other tests this doesn't require network access.
     """
 
-    if stem.util.system.is_mac() or stem.util.system.is_bsd():
-      self.skipTest('(man lacks --encoding arg on OSX and BSD, #18660)')
+    if stem.util.system.is_mac() or stem.util.system.is_bsd() or stem.util.system.is_slackware():
+      self.skipTest('(man lacks --encoding arg on OSX and BSD and Slackware, #18660)')
       return
 
     manual = stem.manual.Manual.from_man(UNKNOWN_OPTIONS_MAN_PATH)
@@ -299,6 +299,7 @@ class TestManual(unittest.TestCase):
 
   @patch('stem.util.system.is_mac', Mock(return_value = False))
   @patch('stem.util.system.is_bsd', Mock(return_value = False))
+  @patch('stem.util.system.is_slackware', Mock(return_value = False))
   @patch('stem.util.system.call', Mock(side_effect = OSError('man --encoding=ascii -P cat tor returned exit status 16')))
   def test_from_man_when_manual_is_unavailable(self):
     exc_msg = "Unable to run 'man --encoding=ascii -P cat tor': man --encoding=ascii -P cat tor returned exit status 16"



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits