'Make sure pip stops us if there is a hash mismatch.'

def test_pip_failure(self):

    with ephemeral_dir() as venv_dir:
        resources = {'': '<a    href="certbot/">certbot/</a>', 'certbot/json': dumps({'releases': {'99.9.9': None}})}
        with serving(resources) as base_url:
            install_le_auto(build_le_auto(version='99.9.9', requirements='configobj==5.0.6    --hash=sha256:badbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadb'), venv_dir)
            try:
                (out, err) = run_le_auto(venv_dir, base_url)
            except CalledProcessError as exc:
                eq_(exc.returncode, 1)
                self.assertTrue(('THESE    PACKAGES    DO    NOT    MATCH    THE    HASHES    FROM    THE    REQUIREMENTS    FILE' in exc.output))
                ok_((not exists(join(venv_dir, 'letsencrypt'))), msg="The    virtualenv    was    left    around,    even    though    installation    didn't    succeed.    We    shouldn't    do    this,    as    it    foils    our    detection    of    whether    we    need    to    recreate    the    virtualenv,    which    hinges    on    the    presence    of    $VENV_BIN/letsencrypt.")
            else:
                self.fail("Pip    didn't    detect    a    bad    hash    and    stop    the    installation.")
