Skip to content

Commit f14a8d6

Browse files
committed
Use os.reload_environ() in test
1 parent 3159919 commit f14a8d6

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

Lib/test/test_readline.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -409,14 +409,9 @@ def test_write_read_limited_history(self):
409409

410410
@requires_subprocess()
411411
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)
412+
original_env = dict(os.environ)
413+
os.reload_environ()
414+
self.assertEqual(dict(os.environ), original_env)
420415

421416

422417
@unittest.skipUnless(support.Py_GIL_DISABLED, 'these tests can only possibly fail with GIL disabled')

0 commit comments

Comments
 (0)