]> granicus.if.org Git - python/commitdiff
bpo-28180: Fix test_capi.test_forced_io_encoding() (#2155)
authorVictor Stinner <victor.stinner@gmail.com>
Tue, 13 Jun 2017 09:49:44 +0000 (11:49 +0200)
committerGitHub <noreply@github.com>
Tue, 13 Jun 2017 09:49:44 +0000 (11:49 +0200)
Don't run Python in an empty environment, but copy the current
environment and set PYTHONIOENCODING. So the test works also on
Python compiled in shared mode (using libpython).

Lib/test/test_capi.py

index c4a976642909497eb90d34bd78d59d85d765b83a..1cf5cd73f0939108604d298fe07f337e572e58b5 100644 (file)
@@ -480,7 +480,7 @@ class EmbeddingTests(unittest.TestCase):
 
     def test_forced_io_encoding(self):
         # Checks forced configuration of embedded interpreter IO streams
-        env = {"PYTHONIOENCODING": "utf-8:surrogateescape"}
+        env = dict(os.environ, PYTHONIOENCODING="utf-8:surrogateescape")
         out, err = self.run_embedded_interpreter("forced_io_encoding", env=env)
         if support.verbose > 1:
             print()