Issue #13415: os.unsetenv() doesn't ignore errors anymore.

This commit is contained in:
Victor Stinner 2011-11-22 22:01:28 +01:00
parent a233df885b
commit 60b385e813
3 changed files with 22 additions and 17 deletions

View file

@ -423,6 +423,15 @@ class EnvironTests(mapping_tests.BasicTestMappingProtocol):
value_str = value.decode(sys.getfilesystemencoding(), 'surrogateescape')
self.assertEqual(os.environ['bytes'], value_str)
def test_unset_error(self):
if sys.platform == "win32":
# an environment variable is limited to 32,767 characters
key = 'x' * 50000
else:
# "=" is not allowed in a variable name
key = 'key='
self.assertRaises(OSError, os.environ.__delitem__, key)
class WalkTests(unittest.TestCase):
"""Tests for os.walk()."""