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
This commit is contained in:
James Carey 2015-01-19 20:17:06 +00:00
parent e9340090fa
commit d9b3ca60a7
1 changed files with 3 additions and 0 deletions

View File

@ -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')