mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
bpo-39413: Implement os.unsetenv() on Windows (GH-18104)
The os.unsetenv() function is now also available on Windows. It is implemented with SetEnvironmentVariableW(name, NULL).
This commit is contained in:
parent
59e2d26b25
commit
56cd3710a1
6 changed files with 92 additions and 12 deletions
|
@ -956,14 +956,9 @@ class EnvironTests(mapping_tests.BasicTestMappingProtocol):
|
|||
# On OS X < 10.6, unsetenv() doesn't return a value (bpo-13415).
|
||||
@support.requires_mac_ver(10, 6)
|
||||
def test_unset_error(self):
|
||||
if sys.platform == "win32":
|
||||
# an environment variable is limited to 32,767 characters
|
||||
key = 'x' * 50000
|
||||
self.assertRaises(ValueError, os.environ.__delitem__, key)
|
||||
else:
|
||||
# "=" is not allowed in a variable name
|
||||
key = 'key='
|
||||
self.assertRaises(OSError, os.environ.__delitem__, key)
|
||||
# "=" is not allowed in a variable name
|
||||
key = 'key='
|
||||
self.assertRaises(OSError, os.environ.__delitem__, key)
|
||||
|
||||
def test_key_type(self):
|
||||
missing = 'missingkey'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue