From ea576715047f0b4356d2ee39ec7c603305db0e8a Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 2 Jan 2015 12:37:39 -0500 Subject: Use quiet context --- setuptools/tests/test_test.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/setuptools/tests/test_test.py b/setuptools/tests/test_test.py index 1f4a7dda..51c3a9b4 100644 --- a/setuptools/tests/test_test.py +++ b/setuptools/tests/test_test.py @@ -4,15 +4,15 @@ """ import os import site -import sys import pytest -from setuptools.compat import StringIO, PY2 +from setuptools.compat import PY2 from setuptools.command.test import test from setuptools.dist import Distribution from .textwrap import DALS +from . import contexts SETUP_PY = DALS(""" from setuptools import setup @@ -90,13 +90,10 @@ class TestTestTest: cmd.ensure_finalized() cmd.install_dir = site.USER_SITE cmd.user = 1 - old_stdout = sys.stdout - sys.stdout = StringIO() - try: - try: # try/except/finally doesn't work in Python 2.4, so we need nested try-statements. + with contexts.quiet(): + try: cmd.run() - except SystemExit: # The test runner calls sys.exit, stop that making an error. + except SystemExit: + # The test runner calls sys.exit; suppress the exception pass - finally: - sys.stdout = old_stdout -- cgit v1.2.1