def test_main_help_class(self, main_log_handler_mock, mkdir_mock):
"""Test help output for a class of modules."""
path_to_ec2rl = os.path.abspath("ec2rl")
test_path = os.path.sep.join([os.path.split(path_to_ec2rl)[0], "test", "modules", "ec2rl"])
sys.argv = [test_path, "help", "--only-classes=diagnose,asdf"]
ec2rl = ec2rlcore.main.Main(full_init=True)
with contextlib.redirect_stdout(self.output):
self.assertTrue(ec2rl.help())
# Check that the length of the help message matches the expected value
self.assertEqual(len(self.output.getvalue()), 1777)
self.assertTrue(self.output.getvalue().startswith("arpcache:\nDetermines if aggressive arp caching is enabled"))
self.assertTrue(self.output.getvalue().endswith("ackets to drop due to discarded skbs\nRequires sudo: False\n"))
self.assertTrue(main_log_handler_mock.called)
self.assertTrue(mkdir_mock.called)
评论列表
文章目录