diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2015-01-02 12:37:39 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2015-01-02 12:37:39 -0500 |
commit | ea576715047f0b4356d2ee39ec7c603305db0e8a (patch) | |
tree | 135baa943a53b1f8c19e704c0f9691f0280ef1d9 | |
parent | 2ebaaf2315395b99b6790717659cb26a25cb715f (diff) | |
download | python-setuptools-git-ea576715047f0b4356d2ee39ec7c603305db0e8a.tar.gz |
Use quiet context
-rw-r--r-- | setuptools/tests/test_test.py | 15 |
1 files 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 |