]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
fixed stdout alteration in test_distutils
authorTarek Ziadé <ziade.tarek@gmail.com>
Sun, 1 Nov 2009 22:33:45 +0000 (22:33 +0000)
committerTarek Ziadé <ziade.tarek@gmail.com>
Sun, 1 Nov 2009 22:33:45 +0000 (22:33 +0000)
Lib/distutils/tests/test_build_py.py
Lib/distutils/tests/test_util.py

index bfe61542735f2a228cf8229cb6b3f943b80be2c9..472591dc09e5c216125db4a57969badc4980a9db 100644 (file)
@@ -69,6 +69,7 @@ class BuildPyTestCase(support.TempdirManager,
         open(os.path.join(testdir, "testfile"), "w").close()
 
         os.chdir(sources)
+        old_stdout = sys.stdout
         sys.stdout = StringIO.StringIO()
 
         try:
@@ -87,7 +88,7 @@ class BuildPyTestCase(support.TempdirManager,
         finally:
             # Restore state.
             os.chdir(cwd)
-            sys.stdout = sys.__stdout__
+            sys.stdout = old_stdout
 
     def test_dont_write_bytecode(self):
         # makes sure byte_compile is not used
index 55ef160f3702128e23d0181f5f57ff056dc8aafc..6722997f5815da132ee0b63664c784e02fd6cc0e 100644 (file)
@@ -60,6 +60,8 @@ class UtilTestCase(support.EnvironGuard, unittest.TestCase):
         util.find_executable = self._find_executable
         self._exes = {}
         self.old_popen = subprocess.Popen
+        self.old_stdout  = sys.stdout
+        self.old_stderr = sys.stderr
         FakePopen.test_class = self
         subprocess.Popen = FakePopen
 
@@ -79,6 +81,8 @@ class UtilTestCase(support.EnvironGuard, unittest.TestCase):
         sysconfig._config_vars = copy(self._config_vars)
         util.find_executable = self.old_find_executable
         subprocess.Popen = self.old_popen
+        sys.old_stdout  = self.old_stdout
+        sys.old_stderr = self.old_stderr
         super(UtilTestCase, self).tearDown()
 
     def _set_uname(self, uname):