From 5c573e00a168c90c5c718566c75aadf736566676 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Mon, 12 Aug 2013 08:26:50 -0400 Subject: testsuite: fixed more unit tests --- src/lib/Bcfg2/Options/Common.py | 20 +++++++++----------- src/lib/Bcfg2/Options/OptionGroups.py | 8 ++++---- src/lib/Bcfg2/Options/Subcommands.py | 9 +++++---- 3 files changed, 18 insertions(+), 19 deletions(-) (limited to 'src/lib/Bcfg2/Options') diff --git a/src/lib/Bcfg2/Options/Common.py b/src/lib/Bcfg2/Options/Common.py index b44c58990..a00bb241c 100644 --- a/src/lib/Bcfg2/Options/Common.py +++ b/src/lib/Bcfg2/Options/Common.py @@ -1,5 +1,6 @@ """ Common options used in multiple different contexts. """ +from Bcfg2.Utils import classproperty # pylint: disable=W0403 import Types from Actions import PluginsAction, ComponentAction @@ -10,17 +11,6 @@ from Options import Option, PathOption, BooleanOption __all__ = ["Common"] -class classproperty(object): - """ Decorator that can be used to create read-only class - properties. """ - - def __init__(self, getter): - self.getter = getter - - def __get__(self, instance, owner): - return self.getter(owner) - - class ReportingTransportAction(ComponentAction): """ :class:`Bcfg2.Options.ComponentAction` that loads a single reporting transport from :mod:`Bcfg2.Reporting.Transport`. """ @@ -62,6 +52,8 @@ class Common(object): import Bcfg2.Server.FileMonitor class FileMonitorAction(ComponentAction): + """ ComponentAction for loading a single FAM backend + class """ islist = False mapping = Bcfg2.Server.FileMonitor.available @@ -135,3 +127,9 @@ class Common(object): default_paranoid = Option( cf=('mdata', 'paranoid'), dest="default_paranoid", default='true', choices=['true', 'false'], help='Default Path paranoid setting') + + #: Client timeout + client_timeout = Option( + "-t", "--timeout", type=float, default=90.0, dest="client_timeout", + cf=('communication', 'timeout'), + help='Set the client XML-RPC timeout') diff --git a/src/lib/Bcfg2/Options/OptionGroups.py b/src/lib/Bcfg2/Options/OptionGroups.py index 6cbe1a8e3..70cb5d0dd 100644 --- a/src/lib/Bcfg2/Options/OptionGroups.py +++ b/src/lib/Bcfg2/Options/OptionGroups.py @@ -35,7 +35,7 @@ class OptionGroup(OptionContainer): behind the scenes. """ def __init__(self, *items, **kwargs): - """ + r""" :param \*args: Child options :type \*args: Bcfg2.Options.Option :param title: The title of the option group @@ -59,7 +59,7 @@ class ExclusiveOptionGroup(OptionContainer): behind the scenes.""" def __init__(self, *items, **kwargs): - """ + r""" :param \*args: Child options :type \*args: Bcfg2.Options.Option :param required: Exactly one argument in the group *must* be @@ -89,7 +89,7 @@ class Subparser(OptionContainer): _subparsers = dict() def __init__(self, *items, **kwargs): - """ + r""" :param \*args: Child options :type \*args: Bcfg2.Options.Option :param name: The name of the subparser. Required. @@ -159,7 +159,7 @@ class WildcardSectionGroup(OptionContainer, Option): _dest_re = re.compile(r'(\A(_|[^A-Za-z])+)|((_|[^A-Za-z0-9])+)') def __init__(self, *items, **kwargs): - """ + r""" :param \*args: Child options :type \*args: Bcfg2.Options.Option :param prefix: The prefix to use for options generated by this diff --git a/src/lib/Bcfg2/Options/Subcommands.py b/src/lib/Bcfg2/Options/Subcommands.py index 53c4e563f..b529dd7fe 100644 --- a/src/lib/Bcfg2/Options/Subcommands.py +++ b/src/lib/Bcfg2/Options/Subcommands.py @@ -8,10 +8,11 @@ import copy import shlex import logging from Bcfg2.Compat import StringIO +# pylint: disable=W0403 from OptionGroups import Subparser from Options import PositionalArgument from Parser import Parser, setup as master_setup - +# pylint: enable=W0403 __all__ = ["Subcommand", "HelpCommand", "CommandRegistry", "register_commands"] @@ -94,9 +95,9 @@ class Subcommand(object): def usage(self): """ Get the short usage message. """ if self._usage is None: - io = StringIO() - self.parser.print_usage(file=io) - usage = self._ws_re.sub(' ', io.getvalue()).strip()[7:] + sio = StringIO() + self.parser.print_usage(file=sio) + usage = self._ws_re.sub(' ', sio.getvalue()).strip()[7:] doc = self._ws_re.sub(' ', getattr(self, "__doc__")).strip() if doc is None: self._usage = usage -- cgit v1.2.3-1-g7c22