[Python-checkins] bpo-33455: Pass os.environ in test_posix::test_specify_environment. (GH-6753)

Miss Islington (bot) webhook-mailer at python.org
Fri May 11 02:01:47 EDT 2018


https://github.com/python/cpython/commit/6e9456e4f6123b13750a10e6ae2eba83504d2f1a
commit: 6e9456e4f6123b13750a10e6ae2eba83504d2f1a
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018-05-10T23:01:44-07:00
summary:

bpo-33455: Pass os.environ in test_posix::test_specify_environment. (GH-6753)


Pass os.environ's copy to new process created at test_posix:
test_specify_environment. Otherwise important variables such as
LD_LIBRARY_PATH are not set and the child process might not work at all
in an environment where such variables are required for Python to function.
(cherry picked from commit 7ec8f28656ea9d84048e9b5655375c6a74a59f53)

Co-authored-by: Miro Hrončok <miro at hroncok.cz>

files:
M Lib/test/test_posix.py

diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index b94da3f45a2c..ecf3e93eb048 100644
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -1462,7 +1462,7 @@ def test_specify_environment(self):
         """
         pid = posix.posix_spawn(sys.executable,
                                 [sys.executable, '-c', script],
-                                {'foo': 'bar'})
+                                {**os.environ, 'foo': 'bar'})
         self.assertEqual(os.waitpid(pid, 0), (pid, 0))
         with open(envfile) as f:
             self.assertEqual(f.read(), 'bar')



More information about the Python-checkins mailing list