def test_captcha_fail_save(self):
        captcha_solver = CaptchaSolver(None)
        test_img = cv2.imread(os.path.join(os.getcwd(), 'test_ocr_valid.png'))
        captcha_solver.solve_captcha(test_img)
        captcha_solver.notify_last_captcha_fail()
        assert os.path.exists(os.path.join(os.getcwd(), 'captcha', 'incorrect', 'captcha1.png'))
        captcha_solver.notify_last_captcha_fail()
        assert os.path.exists(os.path.join(os.getcwd(), 'captcha', 'incorrect', 'captcha2.png'))

        os.remove(os.path.join(os.getcwd(), 'captcha', 'incorrect', 'captcha1.png'))
        os.remove(os.path.join(os.getcwd(), 'captcha', 'incorrect', 'captcha2.png'))
    def test_captcha_fail_save(self, tmpdir, testdatadir):
        td = tmpdir.mkdir('captcha')
        captcha_solver = CaptchaSolver(None, outdir=td)
        test_img = cv2.imread(testdatadir.join('test_ocr_valid.png').strpath)

        captcha_solver.solve_captcha(test_img)
        captcha_solver.notify_last_captcha_fail()
        assert os.path.exists(td.join('incorrect', 'captcha1.png'))

        captcha_solver.notify_last_captcha_fail()
        assert os.path.exists(td.join('incorrect', 'captcha2.png'))