File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 33"""
44import locale
55import os
6+ import subprocess
67import sys
78import tempfile
89import textwrap
910import threading
1011import unittest
1112from test import support
13+ from test .support import requires_subprocess
1214from test .support import threading_helper
1315from test .support import verbose
1416from test .support .import_helper import import_module
@@ -405,6 +407,17 @@ def test_write_read_limited_history(self):
405407 # So, we've only tested that the read did not fail.
406408 # See TestHistoryManipulation for the full test.
407409
410+ @requires_subprocess ()
411+ def test_environment_is_not_modified (self ):
412+ env_output = subprocess .check_output (["env" ])
413+ env_lines = env_output .decode ('utf-8' , 'surrogateescape' ).splitlines ()
414+ current_env = dict ([line .split ('=' , 1 ) for line in env_lines ])
415+
416+ changes = {k for k in set (os .environ ).union (current_env )
417+ if os .getenv (k ) != current_env .get (k )}
418+
419+ self .assertEqual (len (changes ), 0 )
420+
408421
409422@unittest .skipUnless (support .Py_GIL_DISABLED , 'these tests can only possibly fail with GIL disabled' )
410423class FreeThreadingTest (unittest .TestCase ):
You can’t perform that action at this time.
0 commit comments