Skip gen_locale test if charmaps aren't available on the test machine

The error of missing charmaps gets logged to the user. We shouldn't
be running the test for the gen_locale if we don't have charmaps
available on the test machine.
This commit is contained in:
rallytime 2017-04-24 12:17:29 -06:00
parent 532cefe62e
commit e3550ab44c

View File

@ -31,6 +31,15 @@ class LocaleModuleTest(ModuleCase):
@destructiveTest
def test_gen_locale(self):
# Make sure charmaps are available on test system before attempting
# 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'])
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])