fix failing unit test

Reload the locales module to discard the memoization of get_encodings()
This commit is contained in:
Michael Steed 2015-06-10 10:55:51 -06:00
parent 24343645c3
commit 63531c2a3d

View File

@ -11,12 +11,14 @@ from salttesting.mock import patch, NO_MOCK, NO_MOCK_REASON
# salt libs
ensure_in_syspath('../../')
import salt.ext.six as six
from salt.ext.six.moves import reload_module
from salt.utils import locales
@skipIf(NO_MOCK, NO_MOCK_REASON)
class TestLocales(TestCase):
def test_get_encodings(self):
reload_module(locales) # defeat memoization of get_encodings()
with patch('sys.getdefaultencoding', return_value='xyzzy'):
encodings = locales.get_encodings()
for enc in (__salt_system_encoding__, 'xyzzy', 'utf-8', 'latin-1'):