summaryrefslogtreecommitdiffhomepage
path: root/tests/16_test_supercommand.py
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2017-11-12 17:48:03 +0100
committerGuido Günther <agx@sigxcpu.org>2017-11-12 17:48:03 +0100
commitdcf3e4f704285c7df84c425eb0fd8c3fecbc98c2 (patch)
tree85e09f927a33acccff32492b4aafdfc6a911a012 /tests/16_test_supercommand.py
parent57c671b7f2050edfb5a6e01330c2391bde04dbb5 (diff)
Use assertRaises as context manager
for better readability Gbp-Dch: Ignore
Diffstat (limited to 'tests/16_test_supercommand.py')
-rw-r--r--tests/16_test_supercommand.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/tests/16_test_supercommand.py b/tests/16_test_supercommand.py
index d15ec797..f9172df7 100644
--- a/tests/16_test_supercommand.py
+++ b/tests/16_test_supercommand.py
@@ -25,15 +25,12 @@ class TestSuperCommand(unittest.TestCase):
def test_import(self):
"""Test the importer itself"""
- self.assertRaises(ImportError,
- gbp.scripts.supercommand.import_command,
- 'not.allowed')
- self.assertRaises(ImportError,
- gbp.scripts.supercommand.import_command,
- 'not/allowed')
- self.assertRaises(ImportError,
- gbp.scripts.supercommand.import_command,
- '0notallowed')
+ with self.assertRaises(ImportError):
+ gbp.scripts.supercommand.import_command('not.allowed')
+ with self.assertRaises(ImportError):
+ gbp.scripts.supercommand.import_command('not/allowed')
+ with self.assertRaises(ImportError):
+ gbp.scripts.supercommand.import_command('0notallowed')
self.assertIsNotNone(gbp.scripts.supercommand.import_command('pq'))
def test_invalid_command(self):