def test_wenviron(): name, value = u'PYPY_TEST_日本', u'foobar日本' rwin32._wputenv(name, value) assert rwin32._wgetenv(name) == value env = dict(rwin32._wenviron_items()) assert env[name] == value for key, value in env.iteritems(): assert type(key) is unicode assert type(value) is unicode
def test_wenviron(): name, value = u"PYPY_TEST_日本", u"foobar日本" rwin32._wputenv(name, value) assert rwin32._wgetenv(name) == value env = dict(rwin32._wenviron_items()) assert env[name] == value for key, value in env.iteritems(): assert type(key) is unicode assert type(value) is unicode
def putenv(space, name, value): """Change or add an environment variable.""" # len includes space for '=' and a trailing NUL if len(name) + len(value) + 2 > rwin32._MAX_ENV: msg = ("the environment variable is longer than %d characters" % rwin32._MAX_ENV) raise OperationError(space.w_ValueError, space.wrap(msg)) try: rwin32._wputenv(name, value) except OSError, e: raise wrap_oserror(space, e)