Commit 23c128e6 authored by Jason R. Coombs's avatar Jason R. Coombs

Suppress exceptions in a context for clarity, brevity, and reuse.

parent ea576715
......@@ -83,3 +83,11 @@ def save_user_site_setting():
yield saved
finally:
site.ENABLE_USER_SITE = saved
@contextlib.contextmanager
def suppress_exceptions(*excs):
try:
yield
except excs:
pass
......@@ -91,9 +91,6 @@ class TestTestTest:
cmd.install_dir = site.USER_SITE
cmd.user = 1
with contexts.quiet():
try:
# The test runner calls sys.exit
with contexts.suppress_exceptions(SystemExit):
cmd.run()
except SystemExit:
# The test runner calls sys.exit; suppress the exception
pass
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment