diff --git a/openstackclient/common/clientmanager.py b/openstackclient/common/clientmanager.py index fd88bde..938dd05 100644 --- a/openstackclient/common/clientmanager.py +++ b/openstackclient/common/clientmanager.py @@ -37,6 +37,7 @@ USER_AGENT = 'python-openstackclient' class ClientCache(object): """Descriptor class for caching created client handles.""" + def __init__(self, factory): self.factory = factory self._handle = None diff --git a/openstackclient/common/command.py b/openstackclient/common/command.py index 13b0bcc..fee4559 100644 --- a/openstackclient/common/command.py +++ b/openstackclient/common/command.py @@ -22,6 +22,7 @@ import six class CommandMeta(abc.ABCMeta): + def __new__(mcs, name, bases, cls_dict): if 'log' not in cls_dict: cls_dict['log'] = logging.getLogger( diff --git a/openstackclient/common/exceptions.py b/openstackclient/common/exceptions.py index 8ec4993..5f5f5ab 100644 --- a/openstackclient/common/exceptions.py +++ b/openstackclient/common/exceptions.py @@ -41,6 +41,7 @@ class UnsupportedVersion(Exception): class ClientException(Exception): """The base exception class for all exceptions this library raises.""" + def __init__(self, code, message=None, details=None): self.code = code self.message = message or self.__class__.message diff --git a/openstackclient/tests/common/test_clientmanager.py b/openstackclient/tests/common/test_clientmanager.py index ef46f61..2bd9e78 100644 --- a/openstackclient/tests/common/test_clientmanager.py +++ b/openstackclient/tests/common/test_clientmanager.py @@ -47,6 +47,7 @@ class Container(object): class FakeOptions(object): + def __init__(self, **kwargs): for option in auth.OPTIONS_LIST: setattr(self, option.replace('-', '_'), None) @@ -71,6 +72,7 @@ class TestClientCache(utils.TestCase): class TestClientManager(utils.TestCase): + def setUp(self): super(TestClientManager, self).setUp() self.mock = mock.Mock() diff --git a/openstackclient/tests/common/test_command.py b/openstackclient/tests/common/test_command.py index 1b2584b..7467d9e 100644 --- a/openstackclient/tests/common/test_command.py +++ b/openstackclient/tests/common/test_command.py @@ -19,6 +19,7 @@ from openstackclient.tests import utils as test_utils class FakeCommand(command.Command): + def take_action(self, parsed_args): pass diff --git a/openstackclient/tests/common/test_commandmanager.py b/openstackclient/tests/common/test_commandmanager.py index 37dc90f..e2b274d 100644 --- a/openstackclient/tests/common/test_commandmanager.py +++ b/openstackclient/tests/common/test_commandmanager.py @@ -20,6 +20,7 @@ from openstackclient.tests import utils class FakeCommand(object): + @classmethod def load(cls): return cls @@ -48,6 +49,7 @@ class FakeCommandManager(commandmanager.CommandManager): class TestCommandManager(utils.TestCase): + def test_add_command_group(self): mgr = FakeCommandManager('test') diff --git a/openstackclient/tests/common/test_logs.py b/openstackclient/tests/common/test_logs.py index a319533..0386cdf 100644 --- a/openstackclient/tests/common/test_logs.py +++ b/openstackclient/tests/common/test_logs.py @@ -66,6 +66,7 @@ class TestContext(utils.TestCase): class TestFileFormatter(utils.TestCase): + def test_nothing(self): formatter = logs._FileFormatter() self.assertEqual(('%(asctime)s.%(msecs)03d %(process)d %(levelname)s ' @@ -93,6 +94,7 @@ class TestFileFormatter(utils.TestCase): class TestLogConfigurator(utils.TestCase): + def setUp(self): super(TestLogConfigurator, self).setUp() self.options = mock.Mock() diff --git a/openstackclient/tests/common/test_timing.py b/openstackclient/tests/common/test_timing.py index c4c738b..e33bb7a 100644 --- a/openstackclient/tests/common/test_timing.py +++ b/openstackclient/tests/common/test_timing.py @@ -75,7 +75,7 @@ class TestTiming(utils.TestCommand): def test_timing_list(self): self.app.timing_data = [( timing_url, - datetime.timedelta(microseconds=timing_elapsed*1000000), + datetime.timedelta(microseconds=timing_elapsed * 1000000), )] arglist = [] diff --git a/openstackclient/tests/common/test_utils.py b/openstackclient/tests/common/test_utils.py index da7ce06..95bce45 100644 --- a/openstackclient/tests/common/test_utils.py +++ b/openstackclient/tests/common/test_utils.py @@ -250,6 +250,7 @@ class NoUniqueMatch(Exception): class TestFindResource(test_utils.TestCase): + def setUp(self): super(TestFindResource, self).setUp() self.name = 'legos' diff --git a/openstackclient/tests/fakes.py b/openstackclient/tests/fakes.py index 718dff6..9fdcc7e 100644 --- a/openstackclient/tests/fakes.py +++ b/openstackclient/tests/fakes.py @@ -51,6 +51,7 @@ TEST_VERSIONS = fixture.DiscoveryList(href=AUTH_URL) class FakeStdout(object): + def __init__(self): self.content = [] @@ -65,6 +66,7 @@ class FakeStdout(object): class FakeLog(object): + def __init__(self): self.messages = {} @@ -85,6 +87,7 @@ class FakeLog(object): class FakeApp(object): + def __init__(self, _stdout, _log): self.stdout = _stdout self.client_manager = None @@ -95,12 +98,14 @@ class FakeApp(object): class FakeClient(object): + def __init__(self, **kwargs): self.endpoint = kwargs['endpoint'] self.token = kwargs['token'] class FakeClientManager(object): + def __init__(self): self.compute = None self.identity = None @@ -129,12 +134,14 @@ class FakeClientManager(object): class FakeModule(object): + def __init__(self, name, version): self.name = name self.__version__ = version class FakeResource(object): + def __init__(self, manager=None, info={}, loaded=False, methods={}): """Set attributes and methods for a resource. @@ -178,6 +185,7 @@ class FakeResource(object): class FakeResponse(requests.Response): + def __init__(self, headers={}, status_code=200, data=None, encoding=None): super(FakeResponse, self).__init__() @@ -190,6 +198,7 @@ class FakeResponse(requests.Response): class FakeModel(dict): + def __getattr__(self, key): try: return self[key] diff --git a/openstackclient/tests/test_shell.py b/openstackclient/tests/test_shell.py index 80b1816..4a8968c 100644 --- a/openstackclient/tests/test_shell.py +++ b/openstackclient/tests/test_shell.py @@ -161,6 +161,7 @@ def fake_execute(shell, cmd): class TestShell(utils.TestCase): + def setUp(self): super(TestShell, self).setUp() patch = "openstackclient.shell.OpenStackShell.run_subcommand" @@ -280,6 +281,7 @@ class TestShell(utils.TestCase): class TestShellHelp(TestShell): """Test the deferred help flag""" + def setUp(self): super(TestShellHelp, self).setUp() self.orig_env, os.environ = os.environ, {} @@ -304,6 +306,7 @@ class TestShellHelp(TestShell): class TestShellOptions(TestShell): + def setUp(self): super(TestShellOptions, self).setUp() self.orig_env, os.environ = os.environ, {} @@ -391,6 +394,7 @@ class TestShellOptions(TestShell): class TestShellTokenAuthEnv(TestShell): + def setUp(self): super(TestShellTokenAuthEnv, self).setUp() env = { @@ -438,6 +442,7 @@ class TestShellTokenAuthEnv(TestShell): class TestShellTokenEndpointAuthEnv(TestShell): + def setUp(self): super(TestShellTokenEndpointAuthEnv, self).setUp() env = { @@ -485,6 +490,7 @@ class TestShellTokenEndpointAuthEnv(TestShell): class TestShellCli(TestShell): + def setUp(self): super(TestShellCli, self).setUp() env = { @@ -706,6 +712,7 @@ class TestShellCli(TestShell): class TestShellCliEnv(TestShell): + def setUp(self): super(TestShellCliEnv, self).setUp() env = { diff --git a/openstackclient/tests/utils.py b/openstackclient/tests/utils.py index d9abd57..d3f3853 100644 --- a/openstackclient/tests/utils.py +++ b/openstackclient/tests/utils.py @@ -28,6 +28,7 @@ class ParserException(Exception): class TestCase(testtools.TestCase): + def setUp(self): testtools.TestCase.setUp(self)