Skip to content

Commit 0639ea4

Browse files
committed
fix 'eb --help=rst' when running with Python 3
1 parent 0429b6b commit 0639ea4

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

easybuild/tools/utilities.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,10 @@ def mk_rst_table(titles, columns):
258258
"""
259259
Returns an rst table with given titles and columns (a nested list of string columns for each column)
260260
"""
261+
# take into account that passed values may be iterators produced via 'map'
262+
titles = list(titles)
263+
columns = list(columns)
264+
261265
title_cnt, col_cnt = len(titles), len(columns)
262266
if title_cnt != col_cnt:
263267
msg = "Number of titles/columns should be equal, found %d titles and %d columns" % (title_cnt, col_cnt)

test/framework/options.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,26 @@ def test_help_long(self):
174174
regex = re.compile("default: True; disable with --disable-cleanup-builddir", re.M)
175175
self.assertTrue(regex.search(outtxt), "Pattern '%s' found in: %s" % (regex.pattern, outtxt))
176176

177+
def test_help_rst(self):
178+
"""Test generating --help in RST output format."""
179+
180+
self.mock_stderr(True)
181+
self.mock_stdout(True)
182+
self.eb_main(['--help=rst'], raise_error=True)
183+
stderr, stdout = self.get_stderr(), self.get_stdout()
184+
self.mock_stderr(False)
185+
self.mock_stdout(False)
186+
187+
self.assertFalse(stderr)
188+
189+
patterns = [
190+
r"^Basic options\n-------------",
191+
r"^``--fetch``[ ]*Allow downloading sources",
192+
]
193+
for pattern in patterns:
194+
regex = re.compile(pattern, re.M)
195+
self.assertTrue(regex.search(stdout), "Pattern '%s' should be found in: %s" % (regex.pattern, stdout))
196+
177197
def test_no_args(self):
178198
"""Test using no arguments."""
179199

0 commit comments

Comments
 (0)