def test_panic_handles_exit_error_code(self): with mock.patch.object(builtins, 'print'): with mock.patch("sys.exit") as sys_exit_mock: sops.panic("Foobar", 111) sys_exit_mock.assert_called_with(111)
def test_panic_writes_to_stderr(self): with mock.patch.object(builtins, 'print') as print_mock: with mock.patch("sys.exit") as sys_exit_mock: sops.panic("Foobar") print_mock.assert_called_with("PANIC: Foobar", file=sys.stderr) sys_exit_mock.assert_called_with(1)