@patch('pypdfocr.pypdfocr_tesseract.subprocess.call')
    @patch('pypdfocr.pypdfocr_tesseract.PyTesseract._is_version_uptodate')
    @patch('pypdfocr.pypdfocr_tesseract.os.name')
    @patch('pypdfocr.pypdfocr_tesseract.os.path.exists')
    def test_tesseract_fail(self, mock_os_path_exists, mock_os_name, mock_uptodate, mock_subprocess_call,capsys):
        """
            Get all the checks past and make sure we report the case where tesseract returns a non-zero status
        """
        mock_os_name.__str__.return_value = 'nt'
        p = P.PyTesseract({})
        assert ('tesseract.exe' in p.binary)

        mock_os_path_exists.return_value = True 
        mock_uptodate.return_value = (True,"")
        mock_subprocess_call.return_value = -1
        with pytest.raises(SystemExit):
            p.make_hocr_from_pnm('blah.tiff')

        out, err = capsys.readouterr()
        assert p.msgs['TS_FAILED'] in out
dataset/ETHPy150Open virantha/pypdfocr/test/test_tesseract.py/TestTesseract.test_tesseract_fail/original