def _test_locale(self): child = ipc.Subprocess(['locale'], stdout=ipc.PIPE, stderr=ipc.PIPE ) stdout, stderr = child.communicate() stdout = stdout.splitlines() stderr = stderr.splitlines() assert_equal(stderr, []) data = dict(line.split('=', 1) for line in stdout) has_lc_all = has_lc_ctype = has_lang = 0 for key, value in data.iteritems(): if key == 'LC_ALL': has_lc_all = 1 assert_equal(value, '') elif key == 'LC_CTYPE': has_lc_ctype = 1 assert_equal(value, 'en_US.UTF-8') elif key == 'LANG': has_lang = 1 assert_equal(value, '') elif key == 'LANGUAGE': assert_equal(value, '') else: assert_equal(value, '"POSIX"') assert_true(has_lc_all) assert_true(has_lc_ctype) assert_true(has_lang)
def _test_locale(self): child = ipc.Subprocess(['locale'], stdout=ipc.PIPE, stderr=ipc.PIPE) stdout, stderr = child.communicate() stdout = stdout.splitlines() stderr = stderr.splitlines() assert_equal(stderr, []) data = dict(line.split('=', 1) for line in stdout) has_lc_all = has_lc_ctype = has_lang = 0 for key, value in data.iteritems(): if key == 'LC_ALL': has_lc_all = 1 assert_equal(value, '') elif key == 'LC_CTYPE': has_lc_ctype = 1 assert_equal(value, 'en_US.UTF-8') elif key == 'LANG': has_lang = 1 assert_equal(value, '') elif key == 'LANGUAGE': assert_equal(value, '') else: assert_equal(value, '"POSIX"') assert_true(has_lc_all) assert_true(has_lc_ctype) assert_true(has_lang)
def test_sigint(self): ex = ipc.CalledProcessInterrupted(signal.SIGINT, 'eggs') assert_equal(str(ex), "Command 'eggs' was interrupted by signal SIGINT") assert_true(ex.by_user)