File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -236,13 +236,12 @@ def test_json_loading__failure():
236236 with open (filename , "w" ) as openfile :
237237 openfile .write ("# yeah comments are ok\n {but invalid json: [is not]}" )
238238
239- with mock . patch . object ( config . logging , "error" ) as patched_err_log :
240- assert config .json_maybe_commented (filename ) == {}
239+ with pytest . raises ( SystemExit ) as error :
240+ config .json_maybe_commented (filename )
241241
242- assert patched_err_log .call_args [0 ][0 ] == "Error reading json from %s: %r"
243- assert patched_err_log .call_args [0 ][1 ] == filename
244- assert isinstance (patched_err_log .call_args [0 ][2 ], ValueError )
245- assert patched_err_log .call_count == 1
242+ exit = error .exconly ()
243+ assert "SystemExit: Error reading json from {}:" .format (filename ) in exit
244+ assert "Expecting property name" in exit
246245
247246
248247@pytest .mark .parametrize ("original, alias" , [
You can’t perform that action at this time.
0 commit comments