From 550cb3a365dee4edfdd1563224d5304de2a57fda Mon Sep 17 00:00:00 2001 From: Mads Jensen Date: Thu, 9 Mar 2017 16:17:41 +0100 Subject: Fixed #27818 -- Replaced try/except/pass with contextlib.suppress(). --- tests/bash_completion/tests.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'tests/bash_completion/tests.py') diff --git a/tests/bash_completion/tests.py b/tests/bash_completion/tests.py index 1d35e1f28e..ba2a5ea773 100644 --- a/tests/bash_completion/tests.py +++ b/tests/bash_completion/tests.py @@ -4,6 +4,7 @@ A series of tests to establish that the command-line bash completion works. import os import sys import unittest +from contextlib import suppress from django.apps import apps from django.core.management import ManagementUtility @@ -50,10 +51,8 @@ class BashCompletionTests(unittest.TestCase): def _run_autocomplete(self): util = ManagementUtility(argv=sys.argv) with captured_stdout() as stdout: - try: + with suppress(SystemExit): util.autocomplete() - except SystemExit: - pass return stdout.getvalue().strip().split('\n') def test_django_admin_py(self): -- cgit v1.3