diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-06-25 06:50:00 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-25 06:50:00 (GMT) |
commit | 787826c9316b03ac8a197078ec1cdf98fa840c5c (patch) | |
tree | 7f56970b47897fd01034ebef783b11d13db39b84 /Lib/test/test_posix.py | |
parent | 9dda2caca8edc7ff1285f6b0d1c5279b51854b7d (diff) | |
download | cpython-787826c9316b03ac8a197078ec1cdf98fa840c5c.zip cpython-787826c9316b03ac8a197078ec1cdf98fa840c5c.tar.gz cpython-787826c9316b03ac8a197078ec1cdf98fa840c5c.tar.bz2 |
[2.7] bpo-30746: Prohibited the '=' character in environment variable names (GH-2382) (#2393)
in `os.putenv()` and `os.spawn*()`..
(cherry picked from commit 77703942c5997dff00c48f10df1b29b11645624c)
Diffstat (limited to 'Lib/test/test_posix.py')
-rw-r--r-- | Lib/test/test_posix.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py index e0c84f2..f1626b7 100644 --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -504,6 +504,15 @@ class PosixTester(unittest.TestCase): finally: posix.lchflags(_DUMMY_SYMLINK, dummy_symlink_st.st_flags) + @unittest.skipUnless(hasattr(os, "putenv"), "requires os.putenv()") + def test_putenv(self): + with self.assertRaises(TypeError): + os.putenv('FRUIT\0VEGETABLE', 'cabbage') + with self.assertRaises(TypeError): + os.putenv('FRUIT', 'orange\0VEGETABLE=cabbage') + with self.assertRaises(ValueError): + os.putenv('FRUIT=ORANGE', 'lemon') + @unittest.skipUnless(hasattr(posix, 'getcwd'), 'test needs posix.getcwd()') def test_getcwd_long_pathnames(self): |