Skip to content
Snippets Groups Projects
Commit 336a2a86 authored by Damian Johnson's avatar Damian Johnson
Browse files

Tests requiring man command can't work on bsd

Several tests skipped on OSX need to also be skipped on BSD. There were also
some other newer tests that probably aren't running on OSX.

  ======================================================================
  ERROR: test_saving_manual_as_config
  ----------------------------------------------------------------------
  Traceback (most recent call last):
    File "/tmp/stem/test/require.py", line 58, in wrapped
      return func(self, *args, **kwargs)
    File "/tmp/stem/test/unit/manual.py", line 205, in test_saving_manual_as_config
      manual = stem.manual.Manual.from_man(EXAMPLE_MAN_PATH)
    File "/tmp/stem/stem/manual.py", line 495, in from_man
      categories, config_options = _get_categories(man_output), OrderedDict()
    File "/tmp/stem/stem/manual.py", line 666, in _get_categories
      if lines[-1] == '':
  IndexError: list index out of range

  ----------------------------------------------------------------------
parent 982c36e2
No related branches found
No related tags found
No related merge requests found
......@@ -663,7 +663,7 @@ def _get_categories(content):
if line and not line.startswith(' '):
if category:
if lines[-1] == '':
if lines and lines[-1] == '':
lines = lines[:-1] # sections end with an extra empty line
categories[category] = lines
......
......@@ -153,8 +153,8 @@ class TestManual(unittest.TestCase):
expand our example (or add another).
"""
if stem.util.system.is_mac():
self.skipTest('(man lacks --encoding arg on OSX, #18660)')
if stem.util.system.is_mac() or stem.util.system.is_bsd():
self.skipTest('(man lacks --encoding arg on OSX and BSD, #18660)')
return
manual = stem.manual.Manual.from_man(EXAMPLE_MAN_PATH)
......@@ -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():
self.skipTest('(man lacks --encoding arg on OSX, #18660)')
if stem.util.system.is_mac() or stem.util.system.is_bsd():
self.skipTest('(man lacks --encoding arg on OSX and BSD, #18660)')
return
manual = stem.manual.Manual.from_man(UNKNOWN_OPTIONS_MAN_PATH)
......@@ -202,6 +202,10 @@ class TestManual(unittest.TestCase):
Check that we can save and reload manuals as a config.
"""
if stem.util.system.is_mac() or stem.util.system.is_bsd():
self.skipTest('(man lacks --encoding arg on OSX and BSD, #18660)')
return
manual = stem.manual.Manual.from_man(EXAMPLE_MAN_PATH)
with tempfile.NamedTemporaryFile(prefix = 'saved_test_manual.') as tmp:
......@@ -209,11 +213,16 @@ class TestManual(unittest.TestCase):
loaded_manual = stem.manual.Manual.from_cache(tmp.name)
self.assertEqual(manual, loaded_manual)
@test.require.command('man')
def test_saving_manual_as_sqlite(self):
"""
Check that we can save and reload manuals as sqlite.
"""
if stem.util.system.is_mac() or stem.util.system.is_bsd():
self.skipTest('(man lacks --encoding arg on OSX and BSD, #18660)')
return
manual = stem.manual.Manual.from_man(EXAMPLE_MAN_PATH)
with tempfile.NamedTemporaryFile(prefix = 'saved_test_manual.', suffix = '.sqlite') as tmp:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment