Commits

Tarek Ziadé committed 6dc4faa

fixed stdout alteration in test_distutils

Comments (0)

Files changed (2)

Lib/distutils/tests/test_build_py.py

         open(os.path.join(testdir, "testfile"), "w").close()
 
         os.chdir(sources)
+        old_stdout = sys.stdout
         sys.stdout = StringIO.StringIO()
 
         try:
         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

Lib/distutils/tests/test_util.py

         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
 
         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):