Skip test if no charmaps are found

The "loacle -m" command might not return an error, but it might
just be empty. Let's not fail on a test that we're already logging
to the user.
This commit is contained in:
rallytime 2017-04-24 12:38:49 -06:00
parent 7efebc9f78
commit 3dc93be6f6

View File

@ -34,11 +34,15 @@ class LocaleModuleTest(ModuleCase):
# call gen_locale. We log this error to the user in the function, but
# we don't want to fail this test if this is missing on the test system.
char_maps = self.run_function('cmd.run_all', ['locale -m'])
if char_maps['stdout'] == '':
self.skipTest('locale charmaps not available. Skipping test.')
err_msg = 'cannot read character map directory'
if char_maps['retcode'] != 0 and err_msg in char_maps['stderr']:
self.skipTest('{0}. Cannot generate locale. Skipping test.'.format(
char_maps['stderr'])
)
locale = self.run_function('locale.get_locale')
new_locale = _find_new_locale(locale)
ret = self.run_function('locale.gen_locale', [new_locale])