Skip to content

Commit 4d18a9c

Browse files
committed
Add test
1 parent cd7a850 commit 4d18a9c

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

Lib/test/test_readline.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,16 @@ def my_hook():
431431
readline.set_pre_input_hook(my_hook)
432432
self.assertIs(readline.get_pre_input_hook(), my_hook)
433433

434+
def test_environment_is_not_modified(self):
435+
# os.environ contains enviroment at the time "os" module was loaded, so
436+
# before the "readline" module is loaded.
437+
original_env = dict(os.environ)
438+
439+
# Force refresh of os.environ and make sure it is the same as before the
440+
# refresh.
441+
os.reload_environ()
442+
self.assertEqual(dict(os.environ), original_env)
443+
434444

435445
@unittest.skipUnless(support.Py_GIL_DISABLED, 'these tests can only possibly fail with GIL disabled')
436446
class FreeThreadingTest(unittest.TestCase):

0 commit comments

Comments
 (0)