summaryrefslogtreecommitdiff
path: root/tests/test_cmdline.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2013-12-21 07:59:14 -0500
committerNed Batchelder <ned@nedbatchelder.com>2013-12-21 07:59:14 -0500
commitc83032da703361e6235aa551eccaab40ad5f7c51 (patch)
tree67bc5105887a0592c53b6f5f5b8eaa635e6d007e /tests/test_cmdline.py
parentea7b292810c5c6eda5df93a33e287e9a29da825c (diff)
downloadpython-coveragepy-c83032da703361e6235aa551eccaab40ad5f7c51.tar.gz
Use assertRaises as a context manager now that we can.
Diffstat (limited to 'tests/test_cmdline.py')
-rw-r--r--tests/test_cmdline.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/tests/test_cmdline.py b/tests/test_cmdline.py
index 3edc846..3e92dc7 100644
--- a/tests/test_cmdline.py
+++ b/tests/test_cmdline.py
@@ -126,7 +126,8 @@ class CmdLineTestTest(CmdLineTest):
def test_assert_same_method_calls(self):
# All the other tests here use self.cmd_executes_same in successful
# ways, so here we just check that it fails.
- self.assertRaises(AssertionError, self.cmd_executes_same, "-e", "-c")
+ with self.assertRaises(AssertionError):
+ self.cmd_executes_same("-e", "-c")
class ClassicCmdLineTest(CmdLineTest):
@@ -752,10 +753,8 @@ class CmdMainTest(CoverageTest):
self.assertEqual(err[-2], 'Exception: oh noes!')
def test_internalraise(self):
- self.assertRaisesRegexp(ValueError,
- "coverage is broken",
- coverage.cmdline.main, ['internalraise']
- )
+ with self.assertRaisesRegexp(ValueError, "coverage is broken"):
+ coverage.cmdline.main(['internalraise'])
def test_exit(self):
ret = coverage.cmdline.main(['exit'])