Remove TranslationFixture
It doesn't work and keeping the code obscures that. When tox starts up, it seems to import all tests. Many of these import modules from real Nova. As soon as something imports nova.i18n, the short translators (_, _LI etc) are produced using oslo_i18n. These short translators are then imported directly into the namespace of each module, making them nearly impossible to mock. We could monkeypatch oslo_i18n.TranslatorFactory._make_translation_func, but I don't know a reliable way to do that before any test has imported nova.i18n without touching every test. Change-Id: Idcc4409edae5ddfa0a1c2052a746d6412dda24ac
This commit is contained in:
parent
a7d19832fa
commit
8d8b752237
|
@ -193,7 +193,6 @@ class TestCase(testtools.TestCase):
|
|||
|
||||
self.useFixture(fixtures.NestedTempfile())
|
||||
self.useFixture(fixtures.TempHomeDir())
|
||||
self.useFixture(nova_fixtures.TranslationFixture())
|
||||
self.useFixture(log_fixture.get_logging_handle_error_fixture())
|
||||
|
||||
self.useFixture(nova_fixtures.OutputStreamCapture())
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
"""Fixtures for Nova tests."""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import gettext
|
||||
import logging as std_logging
|
||||
import os
|
||||
import uuid
|
||||
|
@ -56,17 +55,6 @@ class ServiceFixture(fixtures.Fixture):
|
|||
self.addCleanup(self.service.kill)
|
||||
|
||||
|
||||
class TranslationFixture(fixtures.Fixture):
|
||||
"""Use gettext NullTranslation objects in tests."""
|
||||
|
||||
def setUp(self):
|
||||
super(TranslationFixture, self).setUp()
|
||||
nulltrans = gettext.NullTranslations()
|
||||
gettext_fixture = fixtures.MonkeyPatch('gettext.translation',
|
||||
lambda *x, **y: nulltrans)
|
||||
self.gettext_patcher = self.useFixture(gettext_fixture)
|
||||
|
||||
|
||||
class NullHandler(std_logging.Handler):
|
||||
"""custom default NullHandler to attempt to format the record.
|
||||
|
||||
|
|
Loading…
Reference in New Issue