summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_posix.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2023-11-10 16:42:14 (GMT)
committerGitHub <noreply@github.com>2023-11-10 16:42:14 (GMT)
commit0b06d2482d77e02c5d40e221f6046c9c355458b2 (patch)
tree5401420104942e6729d7e9ea93bc89c9fd646ed9 /Lib/test/test_posix.py
parent2e7f0700800c0337a0b1b9471fcef410e3158250 (diff)
downloadcpython-0b06d2482d77e02c5d40e221f6046c9c355458b2.zip
cpython-0b06d2482d77e02c5d40e221f6046c9c355458b2.tar.gz
cpython-0b06d2482d77e02c5d40e221f6046c9c355458b2.tar.bz2
gh-111841: Fix os.putenv() and os.unsetenv() with embedded NUL on Windows (GH-111842)
Diffstat (limited to 'Lib/test/test_posix.py')
-rw-r--r--Lib/test/test_posix.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index 7440779..1722c84 100644
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -1011,20 +1011,20 @@ class PosixTester(unittest.TestCase):
self.assertEqual(type(k), item_type)
self.assertEqual(type(v), item_type)
- @unittest.skipUnless(os.name == 'posix', "see bug gh-111841")
def test_putenv(self):
with self.assertRaises(ValueError):
os.putenv('FRUIT\0VEGETABLE', 'cabbage')
with self.assertRaises(ValueError):
- os.putenv(b'FRUIT\0VEGETABLE', b'cabbage')
- with self.assertRaises(ValueError):
os.putenv('FRUIT', 'orange\0VEGETABLE=cabbage')
with self.assertRaises(ValueError):
- os.putenv(b'FRUIT', b'orange\0VEGETABLE=cabbage')
- with self.assertRaises(ValueError):
os.putenv('FRUIT=ORANGE', 'lemon')
- with self.assertRaises(ValueError):
- os.putenv(b'FRUIT=ORANGE', b'lemon')
+ if os.name == 'posix':
+ with self.assertRaises(ValueError):
+ os.putenv(b'FRUIT\0VEGETABLE', b'cabbage')
+ with self.assertRaises(ValueError):
+ os.putenv(b'FRUIT', b'orange\0VEGETABLE=cabbage')
+ with self.assertRaises(ValueError):
+ os.putenv(b'FRUIT=ORANGE', b'lemon')
@unittest.skipUnless(hasattr(posix, 'getcwd'), 'test needs posix.getcwd()')
def test_getcwd_long_pathnames(self):