44
55from mako .cmd import cmdline
66from .util .assertions import eq_
7- from .util .assertions import raises
7+ from .util .assertions import expect_raises
8+ from .util .assertions import expect_raises_message
89from .util .fixtures import template_base
910from .util .fixtures import TemplateTest
1011
@@ -30,7 +31,7 @@ def test_stdin_syntax_err(self):
3031 "sys.stdin" , mock .Mock (read = mock .Mock (return_value = "${x" ))
3132 ):
3233 with self ._capture_output_fixture ("stderr" ) as stderr :
33- with raises (SystemExit ):
34+ with expect_raises (SystemExit ):
3435 cmdline (["--var" , "x=5" , "-" ])
3536
3637 assert (
@@ -43,7 +44,7 @@ def test_stdin_rt_err(self):
4344 "sys.stdin" , mock .Mock (read = mock .Mock (return_value = "${q}" ))
4445 ):
4546 with self ._capture_output_fixture ("stderr" ) as stderr :
46- with raises (SystemExit ):
47+ with expect_raises (SystemExit ):
4748 cmdline (["--var" , "x=5" , "-" ])
4849
4950 assert "NameError: Undefined" in stderr .write .mock_calls [0 ][1 ][0 ]
@@ -59,7 +60,7 @@ def test_file_success(self):
5960
6061 def test_file_syntax_err (self ):
6162 with self ._capture_output_fixture ("stderr" ) as stderr :
62- with raises (SystemExit ):
63+ with expect_raises (SystemExit ):
6364 cmdline (
6465 [
6566 "--var" ,
@@ -73,7 +74,7 @@ def test_file_syntax_err(self):
7374
7475 def test_file_rt_err (self ):
7576 with self ._capture_output_fixture ("stderr" ) as stderr :
76- with raises (SystemExit ):
77+ with expect_raises (SystemExit ):
7778 cmdline (
7879 [
7980 "--var" ,
@@ -86,5 +87,7 @@ def test_file_rt_err(self):
8687 assert "Traceback" in stderr .write .mock_calls [0 ][1 ][0 ]
8788
8889 def test_file_notfound (self ):
89- with raises (SystemExit , "error: can't find fake.lalala" ):
90+ with expect_raises_message (
91+ SystemExit , "error: can't find fake.lalala"
92+ ):
9093 cmdline (["--var" , "x=5" , "fake.lalala" ])
0 commit comments