Message80502
class EnvironTests(mapping_tests.BasicTestMappingProtocol):
"""check that os.environ object conform to mapping protocol"""
type2test = None
def _reference(self):
return {"KEY1":"VALUE1", "KEY2":"VALUE2", "KEY3":"VALUE3"}
def _empty_mapping(self):
vvvvvv
os.environ.clear() <<<<<---------- *******
^^^^^^
return os.environ
def setUp(self):
self.__save = dict(os.environ)
os.environ.clear()
def tearDown(self):
os.environ.clear()
os.environ.update(self.__save)
# Bug 1110478
def test_update2(self):
if os.path.exists("/bin/sh"):
os.environ.update(HELLO="World")
vvvvv
value = os.popen("/bin/sh -c 'echo $HELLO'").read().strip()
^^^^^ finds os.environ['COMSPEC'] to be empty!
self.assertEquals(value, "World")
this test will obviously fail, see _PyPopenCreateProcess in
posixmodule.c.
if (i = GetEnvironmentVariable("COMSPEC",NULL,0)) {
char *comshell;
}
/* Could be an else here to try cmd.exe / command.com in the path
Now we'll just error out.. */
else {
PyErr_SetString(PyExc_RuntimeError,
"Cannot locate a COMSPEC environment variable to "
"use as the shell");
return FALSE;
}
the environment variables having been destroyed, there _is_ no
COMSPEC to obtain a working cmd.exe or command.com in order to
execute the /bin/sh (or /bin/sh.exe in the case of having installed
msys and created a symlink from c:/msys/bin to c:/bin). |
|
Date |
User |
Action |
Args |
2009-01-25 11:39:19 | lkcl | set | recipients:
+ lkcl |
2009-01-25 11:39:18 | lkcl | set | messageid: <1232883558.71.0.175097990327.issue5051@psf.upfronthosting.co.za> |
2009-01-25 11:39:17 | lkcl | link | issue5051 messages |
2009-01-25 11:39:14 | lkcl | create | |
|