'Build failure if latex fails'

def test_build_pdf_latex_failures(self):

    if six.PY3:
        import pytest
        pytest.xfail('test_build_pdf_latex_failures    is    known    to    fail    on    3.6')
    self.mocks.patches['html_build'].stop()
    self.mocks.patches['pdf_build'].stop()
    project = get(Project, slug='project-1', documentation_type='sphinx', conf_py_file='test_conf.py', enable_pdf_build=True, enable_epub_build=False, versions=[fixture()])
    version = project.versions.all()[0]
    assert (project.conf_dir() == '/tmp/rtd')
    build_env = LocalEnvironment(project=project, version=version, build={})
    python_env = Virtualenv(version=version, build_env=build_env)
    config = ConfigWrapper(version=version, yaml_config=create_load()()[0])
    task = UpdateDocsTask(build_env=build_env, project=project, python_env=python_env, version=version, search=False, localmedia=False, config=config)
    returns = [(('', ''), 0), (('', ''), 0), (('', ''), 1), (('', ''), 0), (('', ''), 0)]
    mock_obj = mock.Mock()
    mock_obj.communicate.side_effect = [output for (output, status) in returns]
    type(mock_obj).returncode = mock.PropertyMock(side_effect=[status for (output, status) in returns])
    self.mocks.popen.return_value = mock_obj
    with build_env:
        task.build_docs()
    self.assertEqual(self.mocks.popen.call_count, 7)
    self.assertTrue(build_env.failed)
