cpython: removed spurious output
http://hg.python.org/cpython/rev/42c75548372a changeset: 70519:42c75548372a user: Tarek Ziade <tarek@ziade.org> date: Mon May 30 12:25:21 2011 +0200 summary: removed spurious output files: Lib/packaging/tests/test_uninstall.py | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/Lib/packaging/tests/test_uninstall.py b/Lib/packaging/tests/test_uninstall.py --- a/Lib/packaging/tests/test_uninstall.py +++ b/Lib/packaging/tests/test_uninstall.py @@ -1,6 +1,7 @@ """Tests for the uninstall command.""" import os import sys +from io import StringIO from packaging.database import disable_cache, enable_cache from packaging.run import main @@ -79,7 +80,12 @@ if not dirname: dirname = self.make_dist(name, **kw) os.chdir(dirname) - dist = self.run_setup('install_dist', '--prefix=' + self.root_dir) + old_out = sys.stdout + sys.stderr = StringIO() + try: + dist = self.run_setup('install_dist', '--prefix=' + self.root_dir) + finally: + sys.sterr = old_out install_lib = self.get_path(dist, 'purelib') return dist, install_lib -- Repository URL: http://hg.python.org/cpython
On 5/30/2011 6:25 AM, tarek.ziade wrote: Should not old_out be sys.stderr, since that is what you over-write and 'restore'?
+ old_out = sys.stdout + sys.stderr = StringIO() + try: + dist = self.run_setup('install_dist', '--prefix=' + self.root_dir) + finally: + sys.sterr = old_out
Yes, fixing this thanks On Mon, May 30, 2011 at 5:54 PM, Terry Reedy <tjreedy@udel.edu> wrote:
On 5/30/2011 6:25 AM, tarek.ziade wrote:
Should not old_out be sys.stderr, since that is what you over-write and 'restore'?
+ old_out = sys.stdout + sys.stderr = StringIO() + try: + dist = self.run_setup('install_dist', '--prefix=' + self.root_dir) + finally: + sys.sterr = old_out
-- Tarek Ziadé | http://ziade.org
On Mon, May 30, 2011 at 8:25 PM, tarek.ziade <python-checkins@python.org> wrote:
+ old_out = sys.stdout + sys.stderr = StringIO() + try: + dist = self.run_setup('install_dist', '--prefix=' + self.root_dir) + finally: + sys.sterr = old_out
There's actually a helper for this in test.support: with support.captured_stderr(): dist = self.run_setup('install_dist', '--prefix=' + self.root_dir) Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia
participants (4)
-
Nick Coghlan
-
Tarek Ziadé
-
tarek.ziade
-
Terry Reedy