From 0056e4f8bc13a5d0d713796fe97b64ee5cf0a01a Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Mon, 27 Oct 2014 21:47:11 +0100 Subject: [PATCH] Don't translate LOG messages in testsuite There's no need to translate LOG messages in the testsuite since those will never be run in production. Change-Id: Ifd5a427a01cdd773b83fb0a5bee0e59348650936 --- .../db/migrations/alembic/test_migration.py | 11 ++++----- manila/tests/integrated/api/client.py | 23 +++++++++---------- manila/tests/test_misc.py | 4 ++-- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/manila/tests/db/migrations/alembic/test_migration.py b/manila/tests/db/migrations/alembic/test_migration.py index d8b12f5c1e..ff8b0d4527 100644 --- a/manila/tests/db/migrations/alembic/test_migration.py +++ b/manila/tests/db/migrations/alembic/test_migration.py @@ -24,7 +24,6 @@ from oslo.db.sqlalchemy import test_migrations from sqlalchemy.sql import text from manila.db.migrations.alembic import migration -from manila.i18n import _ from manila.openstack.common import log as logging LOG = logging.getLogger('manila.tests.test_migrations') @@ -132,11 +131,11 @@ class ManilaMigrationsCheckers(test_migrations.WalkVersionsMixin): if check: check(self.engine, data) except Exception as e: - LOG.error(_("Failed to migrate to version %(version)s on engine " - "%(engine)s. Exception while running the migration: " - "%(exception)s"), {'version': version, - 'engine': self.engine, - 'exception': e}) + LOG.error("Failed to migrate to version %(version)s on engine " + "%(engine)s. Exception while running the migration: " + "%(exception)s", {'version': version, + 'engine': self.engine, + 'exception': e}) raise def test_walk_versions(self): diff --git a/manila/tests/integrated/api/client.py b/manila/tests/integrated/api/client.py index 6c6bf0428a..658528a616 100644 --- a/manila/tests/integrated/api/client.py +++ b/manila/tests/integrated/api/client.py @@ -17,7 +17,6 @@ import urlparse from oslo.serialization import jsonutils -from manila.i18n import _ from manila.openstack.common import log as logging @@ -34,11 +33,11 @@ class OpenStackApiException(Exception): _status = response.status _body = response.read() - message = _('%(message)s\nStatus Code: %(_status)s\n' - 'Body: %(_body)s') % { - "message": message, - "_status": _status, - "_body": _body + message = ('%(message)s\nStatus Code: %(_status)s\n' + 'Body: %(_body)s') % { + "message": message, + "_status": _status, + "_body": _body } super(OpenStackApiException, self).__init__(message) @@ -47,7 +46,7 @@ class OpenStackApiException(Exception): class OpenStackApiAuthenticationException(OpenStackApiException): def __init__(self, response=None, message=None): if not message: - message = _("Authentication error") + message = "Authentication error" super(OpenStackApiAuthenticationException, self).__init__(message, response) @@ -55,7 +54,7 @@ class OpenStackApiAuthenticationException(OpenStackApiException): class OpenStackApiAuthorizationException(OpenStackApiException): def __init__(self, response=None, message=None): if not message: - message = _("Authorization error") + message = "Authorization error" super(OpenStackApiAuthorizationException, self).__init__(message, response) @@ -63,7 +62,7 @@ class OpenStackApiAuthorizationException(OpenStackApiException): class OpenStackApiNotFoundException(OpenStackApiException): def __init__(self, response=None, message=None): if not message: - message = _("Item not found") + message = "Item not found" super(OpenStackApiNotFoundException, self).__init__(message, response) @@ -105,10 +104,10 @@ class TestOpenStackClient(object): relative_url = parsed_url.path if parsed_url.query: relative_url = relative_url + "?" + parsed_url.query - LOG.info(_("Doing %(method)s on %(relative_url)s"), + LOG.info("Doing %(method)s on %(relative_url)s", {"method": method, "relative_url": relative_url}) if body: - LOG.info(_("Body: %s"), body) + LOG.info("Body: %s", body) conn.request(method, relative_url, body, _headers) response = conn.getresponse() @@ -164,7 +163,7 @@ class TestOpenStackClient(object): raise OpenStackApiAuthorizationException(response=response) else: raise OpenStackApiException( - message=_("Unexpected status code"), + message="Unexpected status code", response=response) return response diff --git a/manila/tests/test_misc.py b/manila/tests/test_misc.py index 683b2862ed..91d4714d5c 100644 --- a/manila/tests/test_misc.py +++ b/manila/tests/test_misc.py @@ -54,6 +54,6 @@ class ProjectTestCase(test.TestCase): fname = os.path.basename(path) missing_downgrade.append(fname) - helpful_msg = (_("The following migrations are missing a downgrade:" - "\n\t%s") % '\n\t'.join(sorted(missing_downgrade))) + helpful_msg = ("The following migrations are missing a downgrade:" + "\n\t%s") % '\n\t'.join(sorted(missing_downgrade)) self.assertTrue(not missing_downgrade, helpful_msg)