[docs]@mock.patch("os.stat")@mock.patch("os.path.isfile")deftest_post_run_check(self,isfile,stat):isfile.return_value=Truestat.return_value.st_size=1024# no exceptions means successforxinTERMINATION_TEXT:case=_case_post_run_check()withmock.patch("builtins.open",mock.mock_open(read_data=x))asmock_file:_post_run_check(case,"1234")
[docs]@mock.patch("os.stat")@mock.patch("os.path.isfile")deftest_post_run_check_no_termination(self,isfile,stat):isfile.return_value=Truestat.return_value.st_size=1024case=_case_post_run_check()withself.assertRaises(CIMEError):withmock.patch("builtins.open",mock.mock_open(read_data="I DONT HAVE A TERMINATION MESSAGE"),)asmock_file:_post_run_check(case,"1234")