Merged revisions 75842 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r75842 | antoine.pitrou | 2009-10-27 20:23:56 +0100 (mar., 27 oct. 2009) | 3 lines

  Fix transient refleak in test_sys.
........
This commit is contained in:
Antoine Pitrou 2009-10-27 19:25:57 +00:00
parent 45ebeb8f24
commit 836f0e217e
1 changed files with 4 additions and 2 deletions

View File

@ -16,6 +16,7 @@ class SysModuleTest(unittest.TestCase):
sys.stdout = self.orig_stdout
sys.stderr = self.orig_stderr
sys.displayhook = self.orig_displayhook
test.support.reap_children()
def test_original_displayhook(self):
import builtins
@ -261,6 +262,7 @@ class SysModuleTest(unittest.TestCase):
self.current_frames_without_threads()
# Test sys._current_frames() in a WITH_THREADS build.
@test.support.reap_threads
def current_frames_with_threads(self):
import threading, _thread
import traceback
@ -424,13 +426,13 @@ class SysModuleTest(unittest.TestCase):
env["PYTHONIOENCODING"] = "cp424"
p = subprocess.Popen([sys.executable, "-c", 'print(chr(0xa2))'],
stdout = subprocess.PIPE, env=env)
out = p.stdout.read()
out = p.communicate()[0].strip()
self.assertEqual(out, "\xa2\n".encode("cp424"))
env["PYTHONIOENCODING"] = "ascii:replace"
p = subprocess.Popen([sys.executable, "-c", 'print(chr(0xa2))'],
stdout = subprocess.PIPE, env=env)
out = p.stdout.read().strip()
out = p.communicate()[0].strip()
self.assertEqual(out, b'?')