From d9b3ca60a7fc3a61c27d0acc54b8222c7bddf9f5 Mon Sep 17 00:00:00 2001 From: James Carey Date: Mon, 19 Jan 2015 20:17:06 +0000 Subject: Clear global cache in test_get_available_languages The test_get_available_languages test assumes that get_available_languages() has not been called prior to the test. That is, it assumes that the global variable _gettextutils._AVAILABLE_LANGUAGES does not already have a domain's languages cached in it. This causes problems if another test case uses get_available_languages(). In order to properly isolate this test case, it is updated to clear the cache prior to testing. Change-Id: Ie04d7d98b51f4cc3cc9f0eda69425349e0801d6f --- oslo_i18n/tests/test_gettextutils.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'oslo_i18n') diff --git a/oslo_i18n/tests/test_gettextutils.py b/oslo_i18n/tests/test_gettextutils.py index f433700..6f0d5c5 100644 --- a/oslo_i18n/tests/test_gettextutils.py +++ b/oslo_i18n/tests/test_gettextutils.py @@ -103,6 +103,9 @@ class GettextTest(test_base.BaseTestCase): return None self.stubs.Set(gettext, 'find', _mock_gettext_find) + # Ensure that no domains are cached + _gettextutils._AVAILABLE_LANGUAGES = {} + # en_US should always be available no matter the domain # and it should also always be the first element since order matters domain_1_languages = _gettextutils.get_available_languages('domain_1') -- cgit v1.2.1