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).
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index 82c441c..50535da 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -956,14 +956,9 @@
# 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'