[autotest] Style nits in lab_inventory module.
This converts the lab_inventory module and its unit tests to better
follow PEP-8 regarding blank lines and column width.
BUG=None
TEST=None
Change-Id: Ie7a5261b46d4fea4db510055615e5968e3cc3201
Reviewed-on: https://chromium-review.googlesource.com/1033338
Commit-Ready: Richard Barnette <jrbarnette@chromium.org>
Tested-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: Allen Li <ayatane@chromium.org>
diff --git a/site_utils/lab_inventory.py b/site_utils/lab_inventory.py
index d43e12d..ddd33af 100755
--- a/site_utils/lab_inventory.py
+++ b/site_utils/lab_inventory.py
@@ -46,7 +46,6 @@
With no arguments, gathers the status for all models in the lab.
With one or more named models on the command line, restricts
reporting to just those models.
-
"""
@@ -170,20 +169,17 @@
self._broken_list = None
self._idle_list = None
-
def record_host(self, host_history):
"""Add one `HostJobHistory` object to the collection.
@param host_history The `HostJobHistory` object to be
remembered.
-
"""
self._working_list = None
self._broken_list = None
self._idle_list = None
self._histories.append(host_history)
-
def get_working_list(self):
"""Return a list of all working DUTs in the pool.
@@ -193,19 +189,16 @@
Cache the result so that we only cacluate it once.
@return A list of HostJobHistory objects.
-
"""
if self._working_list is None:
self._working_list = [h for h in self._histories
if h.last_diagnosis()[0] == status_history.WORKING]
return self._working_list
-
def get_working(self):
"""Return the number of working DUTs in the pool."""
return len(self.get_working_list())
-
def get_broken_list(self):
"""Return a list of all broken DUTs in the pool.
@@ -215,19 +208,16 @@
Cache the result so that we only cacluate it once.
@return A list of HostJobHistory objects.
-
"""
if self._broken_list is None:
self._broken_list = [h for h in self._histories
if h.last_diagnosis()[0] == status_history.BROKEN]
return self._broken_list
-
def get_broken(self):
"""Return the number of broken DUTs in the pool."""
return len(self.get_broken_list())
-
def get_idle_list(self):
"""Return a list of all idle DUTs in the pool.
@@ -237,7 +227,6 @@
Cache the result so that we only cacluate it once.
@return A list of HostJobHistory objects.
-
"""
idle_statuses = {status_history.UNUSED, status_history.UNKNOWN}
if self._idle_list is None:
@@ -245,12 +234,10 @@
if h.last_diagnosis()[0] in idle_statuses]
return self._idle_list
-
def get_idle(self):
"""Return the number of idle DUTs in the pool."""
return len(self.get_idle_list())
-
def get_total(self):
"""Return the total number of DUTs in the pool."""
return len(self._histories)
@@ -281,12 +268,10 @@
@param host_history The `HostJobHistory` object to be
remembered.
-
"""
pool = host_history.host_pool
self._histories_by_pool[pool].record_host(host_history)
-
def _count_pool(self, get_pool_count, pool=None):
"""Internal helper to count hosts in a given pool.
@@ -297,7 +282,6 @@
_PoolCount object.
@param pool The pool to be counted. If `None`,
return the total across all pools.
-
"""
if pool is None:
return sum([get_pool_count(cached_history) for cached_history in
@@ -305,7 +289,6 @@
else:
return get_pool_count(self._histories_by_pool[pool])
-
def get_working_list(self):
"""Return a list of all working DUTs (across all pools).
@@ -313,14 +296,12 @@
ones where the last diagnosis is `WORKING`.
@return A list of HostJobHistory objects.
-
"""
l = []
for p in self._histories_by_pool.values():
l.extend(p.get_working_list())
return l
-
def get_working(self, pool=None):
"""Return the number of working DUTs in a pool.
@@ -332,7 +313,6 @@
"""
return self._count_pool(_HostSetInventory.get_working, pool)
-
def get_broken_list(self):
"""Return a list of all broken DUTs (across all pools).
@@ -340,14 +320,12 @@
selecting the ones where the last diagnosis is `BROKEN`.
@return A list of HostJobHistory objects.
-
"""
l = []
for p in self._histories_by_pool.values():
l.extend(p.get_broken_list())
return l
-
def get_broken(self, pool=None):
"""Return the number of broken DUTs in a pool.
@@ -358,7 +336,6 @@
"""
return self._count_pool(_HostSetInventory.get_broken, pool)
-
def get_idle_list(self, pool=None):
"""Return a list of all idle DUTs in the given pool.
@@ -369,7 +346,6 @@
across all pools.
@return A list of HostJobHistory objects.
-
"""
if pool is None:
l = []
@@ -379,7 +355,6 @@
else:
return self._histories_by_pool[pool].get_idle_list()
-
def get_idle(self, pool=None):
"""Return the number of idle DUTs in a pool.
@@ -390,7 +365,6 @@
"""
return self._count_pool(_HostSetInventory.get_idle, pool)
-
def get_spares_buffer(self, spare_pool=SPARE_POOL):
"""Return the the nominal number of working spares.
@@ -404,7 +378,6 @@
"""
return self.get_total(spare_pool) - self.get_broken()
-
def get_total(self, pool=None):
"""Return the total number of DUTs in a pool.
@@ -466,7 +439,6 @@
@param modellist List of models to include. If empty,
include all available models.
@return A `_LabInventory` object for the specified models.
-
"""
target_pools = MANAGED_POOLS
label_list = [constants.Labels.POOL_PREFIX + l for l in target_pools]
@@ -489,7 +461,6 @@
start_time, end_time))
return cls([create(host) for host in afehosts], target_pools)
-
def __init__(self, histories, pools):
models = {h.host_model for h in histories}
self._modeldata = {model: _PoolSetInventory(pools) for model in models}
@@ -498,21 +469,17 @@
self[h.host_model].record_host(h)
self._boards = {h.host_board for h in histories}
-
def __getitem__(self, key):
return self._modeldata.__getitem__(key)
-
def __len__(self):
return self._modeldata.__len__()
-
def __iter__(self):
return self._modeldata.__iter__()
-
def reportable_items(self, spare_pool=SPARE_POOL):
- """Iterate over all items subject to reporting.
+ """Iterate over all items subject to reporting.
Yields the contents of `self.iteritems()` filtered to include
only reportable models. A model is reportable if it has DUTs in
@@ -526,17 +493,14 @@
if spares != 0 and spares != total:
yield model, histories
-
def get_num_duts(self):
"""Return the total number of DUTs in the inventory."""
return self._dut_count
-
def get_num_models(self):
"""Return the total number of models in the inventory."""
return len(self)
-
def get_pool_models(self, pool):
"""Return all models in `pool`.
@@ -544,7 +508,6 @@
"""
return {m for m, h in self.iteritems() if h.get_total(pool)}
-
def get_boards(self):
return self._boards
@@ -567,7 +530,6 @@
break down.
@return A list of sorted lists of DUTs.
-
"""
BASE = 100
lab_lists = {}
@@ -659,7 +621,6 @@
@param inventory `_LabInventory` object from which to generate
recommendations.
@param num_recommend Number of DUTs to recommend for repair.
-
"""
logging.debug('Creating DUT repair recommendations')
model_buffer_counts = {}
@@ -855,7 +816,6 @@
@param inventory `_LabInventory` object to be reported on.
@return String with the inventory message to be sent.
-
"""
logging.debug('Creating idle inventory')
message = [_IDLE_INVENTORY_HEADER]
@@ -1195,7 +1155,6 @@
@param address_list A list of strings containing comma
separate e-mail addresses.
@return A list of the individual e-mail addresses.
-
"""
newlist = []
for arg in address_list:
@@ -1220,7 +1179,6 @@
`ArgumentParser`
@return True if the arguments are semantically good, or False
if the arguments don't meet requirements.
-
"""
arguments.model_notify = _separate_email_addresses(
arguments.model_notify)
@@ -1250,7 +1208,6 @@
@param script Path to this script file.
@return A path to a directory.
-
"""
basedir = os.path.dirname(os.path.abspath(script))
basedir = os.path.dirname(basedir)
@@ -1267,7 +1224,6 @@
@param argv Standard command line argument vector; argv[0] is
assumed to be the command name.
@return Result returned by ArgumentParser.parse_args().
-
"""
parser = argparse.ArgumentParser(
prog=argv[0],
diff --git a/site_utils/lab_inventory_unittest.py b/site_utils/lab_inventory_unittest.py
index 5418f7e..6e6ce99 100755
--- a/site_utils/lab_inventory_unittest.py
+++ b/site_utils/lab_inventory_unittest.py
@@ -31,7 +31,6 @@
self.status = status
self.host = _FakeHost(hostname)
-
def last_diagnosis(self):
"""Return the recorded diagnosis."""
return self.status, None
@@ -42,11 +41,9 @@
_HOSTNAME_FORMAT = 'chromeos%d-row%d-rack%d-host%d'
-
def __init__(self, location):
self.hostname = self._HOSTNAME_FORMAT % location
-
@property
def host(self):
"""Return a fake host object with a hostname."""
@@ -79,12 +76,10 @@
super(HostSetInventoryTestCase, self).setUp()
self.histories = lab_inventory._HostSetInventory()
-
def _add_host(self, status):
fake = _FakeHostHistory('zebra', lab_inventory.SPARE_POOL, status)
self.histories.record_host(fake)
-
def _check_counts(self, working, broken, idle):
"""Check that pool counts match expectations.
@@ -102,24 +97,20 @@
self.assertEqual(self.histories.get_total(),
working + broken + idle)
-
def test_empty(self):
"""Test counts when there are no DUTs recorded."""
self._check_counts(0, 0, 0)
-
def test_broken(self):
"""Test counting for broken DUTs."""
self._add_host(_BROKEN)
self._check_counts(0, 1, 0)
-
def test_working(self):
"""Test counting for working DUTs."""
self._add_host(_WORKING)
self._check_counts(1, 0, 0)
-
def test_idle(self):
"""Testing counting for idle status values."""
self._add_host(_UNUSED)
@@ -127,14 +118,12 @@
self._add_host(_UNKNOWN)
self._check_counts(0, 0, 2)
-
def test_working_then_broken(self):
"""Test counts after adding a working and then a broken DUT."""
self._add_host(_WORKING)
self._add_host(_BROKEN)
self._check_counts(1, 1, 0)
-
def test_broken_then_working(self):
"""Test counts after adding a broken and then a working DUT."""
self._add_host(_BROKEN)
@@ -159,12 +148,10 @@
super(PoolSetInventoryTestCase, self).setUp()
self._pool_histories = lab_inventory._PoolSetInventory(self._POOL_SET)
-
def _add_host(self, pool, status):
fake = _FakeHostHistory('zebra', pool, status)
self._pool_histories.record_host(fake)
-
def _check_all_counts(self, working, broken):
"""Check that total counts for all pools match expectations.
@@ -179,7 +166,6 @@
@param working The expected total of working devices.
@param broken The expected total of broken devices.
-
"""
self.assertEqual(self._pool_histories.get_working(), working)
self.assertEqual(self._pool_histories.get_broken(), broken)
@@ -196,7 +182,6 @@
self.assertEqual(count_broken, broken)
self.assertEqual(count_total, working + broken)
-
def _check_pool_counts(self, pool, working, broken):
"""Check that counts for a given pool match expectations.
@@ -207,7 +192,6 @@
@param pool The pool to be checked.
@param working The expected total of working devices.
@param broken The expected total of broken devices.
-
"""
self.assertEqual(self._pool_histories.get_working(pool),
working)
@@ -216,14 +200,12 @@
self.assertEqual(self._pool_histories.get_total(pool),
working + broken)
-
def test_empty(self):
"""Test counts when there are no DUTs recorded."""
self._check_all_counts(0, 0)
for pool in self._POOL_SET:
self._check_pool_counts(pool, 0, 0)
-
def test_all_working_then_broken(self):
"""Test counts after adding a working and then a broken DUT.
@@ -242,7 +224,6 @@
self._check_pool_counts(pool, 1, 1)
self._check_all_counts(working, broken)
-
def test_all_broken_then_working(self):
"""Test counts after adding a broken and then a working DUT.
@@ -268,7 +249,6 @@
def setUp(self):
super(LocationSortTests, self).setUp()
-
def _check_sorting(self, *locations):
"""Test sorting a given list of locations.
@@ -278,7 +258,6 @@
flattens and scrambles the input, runs it through
`_sort_by_location()`, and asserts that the result matches
the original.
-
"""
lab = 0
expected = []
@@ -296,27 +275,22 @@
self.assertEqual({l[0]: l for l in expected},
{l[0]: l for l in actual})
-
def test_separate_labs(self):
"""Test that sorting distinguishes labs."""
self._check_sorting([(1, 1, 1)], [(1, 1, 1)], [(1, 1, 1)])
-
def test_separate_rows(self):
"""Test for proper sorting when only rows are different."""
self._check_sorting([(1, 1, 1), (9, 1, 1), (10, 1, 1)])
-
def test_separate_racks(self):
"""Test for proper sorting when only racks are different."""
self._check_sorting([(1, 1, 1), (1, 9, 1), (1, 10, 1)])
-
def test_separate_hosts(self):
"""Test for proper sorting when only hosts are different."""
self._check_sorting([(1, 1, 1), (1, 1, 9), (1, 1, 10)])
-
def test_diagonal(self):
"""Test for proper sorting when all parts are different."""
self._check_sorting([(1, 1, 2), (1, 2, 1), (2, 1, 1)])
@@ -328,7 +302,6 @@
def setUp(self):
super(InventoryScoringTests, self).setUp()
-
def _make_buffer_counts(self, *counts):
"""Create a dictionary suitable as `buffer_counts`.
@@ -336,7 +309,6 @@
"""
self._buffer_counts = dict(counts)
-
def _make_history_list(self, repair_counts):
"""Create a list suitable as `repair_list`.
@@ -350,7 +322,6 @@
_FakeHostHistory(model, pool, _BROKEN))
return histories
-
def _check_better(self, repair_a, repair_b):
"""Test that repair set A scores better than B.
@@ -370,7 +341,6 @@
self._make_history_list(repair_b))
self.assertGreater(score_a, score_b)
-
def _check_equal(self, repair_a, repair_b):
"""Test that repair set A scores the same as B.
@@ -390,7 +360,6 @@
self._make_history_list(repair_b))
self.assertEqual(score_a, score_b)
-
def test_improve_worst_model(self):
"""Test that improving the worst model improves scoring.
@@ -408,7 +377,6 @@
self._check_better([('lion', 1)], [('bear', 2)])
self._check_equal([('tiger', 1)], [('bear', 1)])
-
def test_improve_worst_case_count(self):
"""Test that improving the number of worst cases improves the score.
@@ -470,7 +438,6 @@
_MODEL_LIST = ['lion', 'tiger', 'bear'] # Oh, my!
-
def _check_inventory_counts(self, inventory, data, msg=None):
"""Check that all counts in the inventory match `data`.
@@ -509,7 +476,6 @@
sum([p.idle for p in expected_counts]),
msg)
-
def test_empty(self):
"""Test counts when there are no DUTs recorded."""
inventory = create_inventory({})
@@ -518,7 +484,6 @@
self._check_inventory_counts(inventory, {})
self.assertEqual(inventory.get_num_models(), 0)
-
def _check_model_count(self, model_count):
"""Parameterized test for testing a specific number of models."""
msg = '[model: %d]' % (model_count,)
@@ -538,14 +503,12 @@
set(models))
self._check_inventory_counts(inventory, data, msg=msg)
-
def test_model_counts(self):
"""Test counts for various numbers of models."""
self.longMessage = True
for model_count in range(0, len(self._MODEL_LIST)):
self._check_model_count(model_count)
-
def _check_single_dut_counts(self, critical, spare):
"""Parmeterized test for single dut counts."""
self.longMessage = True
@@ -558,7 +521,6 @@
self.assertEqual(inventory.get_num_models(), 1, msg)
self._check_inventory_counts(inventory, data, msg=msg)
-
def test_single_dut_counts(self):
"""Test counts when there is a single DUT per board, and it is good."""
status_100 = StatusCounts(1, 0, 0)
@@ -622,8 +584,6 @@
bad, idle, good, spare = [int(x) for x in items[2:-1]]
self._model_data.append((model, (good, bad, idle, spare)))
-
-
def _make_minimum_spares(self, counts):
"""Create a counts tuple with as few spare DUTs as possible."""
good, bad, idle, spares = counts
@@ -643,7 +603,6 @@
StatusCounts(0, bad, spares - bad),
)
-
def _make_maximum_spares(self, counts):
"""Create a counts tuple with as many spare DUTs as possible."""
good, bad, idle, spares = counts
@@ -663,7 +622,6 @@
StatusCounts(good, bad, spares - good - bad),
)
-
def _check_message(self, message):
"""Checks that message approximately matches expected string."""
message = [x.strip() for x in message.split('\n') if x.strip()]
@@ -671,7 +629,6 @@
body = message[message.index(self._header) + 1:]
self.assertEqual(body, self._model_lines)
-
def test_minimum_spares(self):
"""Test message generation when the spares pool is low."""
data = {
@@ -692,7 +649,6 @@
message = lab_inventory._generate_model_inventory_message(inventory)
self._check_message(message)
-
def test_ignore_no_spares(self):
"""Test that messages ignore models with no spare pool."""
data = {
@@ -704,7 +660,6 @@
message = lab_inventory._generate_model_inventory_message(inventory)
self._check_message(message)
-
def test_ignore_no_critical(self):
"""Test that messages ignore models with no critical pools."""
data = {
@@ -716,7 +671,6 @@
message = lab_inventory._generate_model_inventory_message(inventory)
self._check_message(message)
-
def test_ignore_no_bad(self):
"""Test that messages ignore models with no bad DUTs."""
data = {
@@ -735,39 +689,36 @@
Func `setUp` in the class parses a given |message_template| to obtain
header and body.
"""
+
def _read_template(self, message_template):
"""Read message template for PoolInventoryTest and IdleInventoryTest.
@param message_template: the input template to be parsed into: header
and content (report_lines).
-
"""
message_lines = message_template.split('\n')
self._header = message_lines[1]
self._report_lines = message_lines[2:-1]
-
def _check_report_no_info(self, text):
"""Test a message body containing no reported info.
- The input `text` was created from a query to an inventory, which has
- no objects meet the query and leads to an `empty` return. Assert that
- the text consists of a single line starting with '(' and ending with ')'.
+ The input `text` was created from a query to an inventory, which
+ has no objects meet the query and leads to an `empty` return.
+ Assert that the text consists of a single line starting with '('
+ and ending with ')'.
@param text: Message body text to be tested.
-
"""
self.assertTrue(len(text) == 1 and
text[0][0] == '(' and
text[0][-1] == ')')
-
def _check_report(self, text):
"""Test a message against the passed |expected_content|.
@param text: Message body text to be tested.
@param expected_content: The ground-truth content to be compared with.
-
"""
self.assertEqual(text, self._report_lines)
@@ -838,7 +789,6 @@
good = int(items[3])
self._model_data.append((model, (good, bad, idle)))
-
def _create_histories(self, pools, model_data):
"""Return a list suitable to create a `_LabInventory` object.
@@ -858,7 +808,6 @@
counts.
@return A list of `_FakeHostHistory` objects that can be
used to create a `_LabInventory` object.
-
"""
histories = []
status_choices = (_WORKING, _BROKEN, _UNUSED)
@@ -870,7 +819,6 @@
_FakeHostHistory(model, pool, status))
return histories
-
def _parse_pool_summaries(self, histories):
"""Parse message output according to the grammar above.
@@ -891,7 +839,6 @@
`_LabInventory` object.
@return A dictionary mapping model names to the output
(a list of lines) for the model.
-
"""
inventory = lab_inventory._LabInventory(
histories, lab_inventory.MANAGED_POOLS)
@@ -929,14 +876,12 @@
self.assertEqual(len(poolset), 0)
return model_text
-
def test_no_shortages(self):
"""Test correct output when no pools have shortages."""
model_text = self._parse_pool_summaries([])
for text in model_text.values():
self._check_report_no_info(text)
-
def test_one_pool_shortage(self):
"""Test correct output when exactly one pool has a shortage."""
for pool in lab_inventory.CRITICAL_POOLS:
@@ -950,7 +895,6 @@
else:
self._check_report_no_info(text)
-
def test_all_pool_shortages(self):
"""Test correct output when all pools have a shortage."""
histories = []
@@ -962,7 +906,6 @@
for pool in lab_inventory.CRITICAL_POOLS:
self._check_report(model_text[pool])
-
def test_full_model_ignored(self):
"""Test that models at full strength are not reported."""
pool = lab_inventory.CRITICAL_POOLS[0]
@@ -976,7 +919,6 @@
text = self._parse_pool_summaries(histories)[pool]
self._check_report(text)
-
def test_spare_pool_ignored(self):
"""Test that reporting ignores the spare pool inventory."""
spare_pool = lab_inventory.SPARE_POOL
@@ -1007,7 +949,6 @@
Parse message text is represented as a list of strings, split on
the `'\n'` separator.
-
"""
def setUp(self):
@@ -1023,7 +964,6 @@
self._histories.append(_FakeHostHistory('echidna', 'bvt', _BROKEN))
self._histories.append(_FakeHostHistory('lion', 'bvt', _WORKING))
-
def _add_idles(self):
"""Add idle duts from `_IDLE_MESSAGE_TEMPLATE`."""
idle_histories = [_FakeHostHistory(
@@ -1031,20 +971,17 @@
for hostname, model, pool in self._host_data]
self._histories.extend(idle_histories)
-
def _check_header(self, text):
"""Check whether header in the template `_IDLE_MESSAGE_TEMPLATE` is in
passed text."""
self.assertIn(self._header, text)
-
def _get_idle_message(self, histories):
"""Generate idle inventory and obtain its message.
@param histories: Used to create lab inventory.
@return the generated idle message.
-
"""
inventory = lab_inventory._LabInventory(
histories, lab_inventory.MANAGED_POOLS)
@@ -1052,7 +989,6 @@
inventory).split('\n')
return message
-
def test_check_idle_inventory(self):
"""Test that reporting all the idle DUTs for every pool, sorted by
lab_inventory.MANAGED_POOLS.
@@ -1063,7 +999,6 @@
self._check_header(message)
self._check_report(message[message.index(self._header) + 1 :])
-
def test_no_idle_inventory(self):
"""Test that reporting no idle DUTs."""
message = self._get_idle_message(self._histories)
@@ -1088,18 +1023,15 @@
'arglebargle')
self._logdir = os.path.join(dirpath, lab_inventory._LOGDIR)
-
def _parse_arguments(self, argv):
"""Test parsing with explictly passed report options."""
full_argv = [self._command_path] + argv
return lab_inventory._parse_command(full_argv)
-
def _parse_non_report_arguments(self, argv):
"""Test parsing for non-report command-line options."""
return self._parse_arguments(argv + self._REPORT_OPTIONS)
-
def _check_non_report_defaults(self, report_option):
arguments = self._parse_arguments([report_option])
self.assertEqual(arguments.duration,
@@ -1110,19 +1042,16 @@
self.assertEqual(arguments.modelnames, [])
return arguments
-
def test_empty_arguments(self):
"""Test that no reports requested is an error."""
arguments = self._parse_arguments([])
self.assertIsNone(arguments)
-
def test_argument_defaults(self):
"""Test that option defaults match expectations."""
for report in self._REPORT_OPTIONS:
arguments = self._check_non_report_defaults(report)
-
def test_model_notify_defaults(self):
"""Test defaults when `--model-notify` is specified alone."""
arguments = self._parse_arguments(['--model-notify='])
@@ -1130,7 +1059,6 @@
self.assertEqual(arguments.pool_notify, [])
self.assertFalse(arguments.report_untestable)
-
def test_pool_notify_defaults(self):
"""Test defaults when `--pool-notify` is specified alone."""
arguments = self._parse_arguments(['--pool-notify='])
@@ -1138,7 +1066,6 @@
self.assertEqual(arguments.pool_notify, [''])
self.assertFalse(arguments.report_untestable)
-
def test_report_untestable_defaults(self):
"""Test defaults when `--report-untestable` is specified alone."""
arguments = self._parse_arguments(['--report-untestable'])
@@ -1146,14 +1073,12 @@
self.assertEqual(arguments.pool_notify, [])
self.assertTrue(arguments.report_untestable)
-
def test_model_arguments(self):
"""Test that non-option arguments are returned in `modelnames`."""
modellist = ['aardvark', 'echidna']
arguments = self._parse_non_report_arguments(modellist)
self.assertEqual(arguments.modelnames, modellist)
-
def test_recommend_option(self):
"""Test parsing of the `--recommend` option."""
for opt in ['-r', '--recommend']:
@@ -1161,13 +1086,11 @@
arguments = self._parse_non_report_arguments([opt, recommend])
self.assertEqual(arguments.recommend, int(recommend))
-
def test_debug_option(self):
"""Test parsing of the `--debug` option."""
arguments = self._parse_non_report_arguments(['--debug'])
self.assertTrue(arguments.debug)
-
def test_duration(self):
"""Test parsing of the `--duration` option."""
for opt in ['-d', '--duration']:
@@ -1175,7 +1098,6 @@
arguments = self._parse_non_report_arguments([opt, duration])
self.assertEqual(arguments.duration, int(duration))
-
def _check_email_option(self, option, getlist):
"""Test parsing of e-mail address options.
@@ -1190,7 +1112,6 @@
@param option The option to be tested.
@param getlist A function to return the option's value from
parsed command line arguments.
-
"""
a1 = 'mumble@mumbler.com'
a2 = 'bumble@bumbler.org'
@@ -1207,19 +1128,16 @@
[option, ', '.join([a1, a2])])
self.assertEqual(getlist(arguments), [a1, a2])
-
def test_model_notify(self):
"""Test parsing of the `--model-notify` option."""
self._check_email_option('--model-notify',
lambda a: a.model_notify)
-
def test_pool_notify(self):
"""Test parsing of the `--pool-notify` option."""
self._check_email_option('--pool-notify',
lambda a: a.pool_notify)
-
def test_logdir_option(self):
"""Test parsing of the `--logdir` option."""
logdir = '/usr/local/whatsis/logs'