Revision f6441c7c
b/lib/utils.py | ||
---|---|---|
209 | 209 |
else: |
210 | 210 |
strcmd = cmd |
211 | 211 |
shell = True |
212 |
new_env = dict([(key, val) for (key, val) in os.environ.items() |
|
213 |
if not (key == "LANG" or key.startswith("LC_"))]) |
|
212 | 214 |
child = subprocess.Popen(cmd, shell=shell, |
213 | 215 |
stderr=subprocess.PIPE, |
214 | 216 |
stdout=subprocess.PIPE, |
215 | 217 |
stdin=subprocess.PIPE, |
216 |
close_fds=True) |
|
218 |
close_fds=True, env=new_env)
|
|
217 | 219 |
|
218 | 220 |
child.stdin.close() |
219 | 221 |
out = child.stdout.read() |
b/testing/ganeti.utils_unittest.py | ||
---|---|---|
149 | 149 |
self.assertEqual(result.exit_code, 0) |
150 | 150 |
self.assertEqual(result.stdout, self.magic) |
151 | 151 |
|
152 |
def testLang(self): |
|
153 |
"""Test locale environment""" |
|
154 |
os.environ["LANG"] = "en_US.UTF-8" |
|
155 |
os.environ["LC_ALL"] = "en_US.UTF-8" |
|
156 |
result = RunCmd(["env"]) |
|
157 |
for line in result.output.splitlines(): |
|
158 |
key, val = line.split("=", 1) |
|
159 |
if key.startswith("LC_") or key == "LANG": |
|
160 |
self.fail("Unexpected language variable '%s' = '%s'" % (key, val)) |
|
161 |
|
|
152 | 162 |
|
153 | 163 |
class TestRemoveFile(unittest.TestCase): |
154 | 164 |
"""Test case for the RemoveFile function""" |
Also available in: Unified diff