add parallel to SphinxTestApp

This commit is contained in:
Robert Cohn 2020-09-30 20:47:56 -04:00
parent d8c006f1c0
commit c08214fe92
2 changed files with 8 additions and 2 deletions

View File

@ -108,7 +108,7 @@ class SphinxTestApp(application.Sphinx):
def __init__(self, buildername: str = 'html', srcdir: path = None, freshenv: bool = False, def __init__(self, buildername: str = 'html', srcdir: path = None, freshenv: bool = False,
confoverrides: Dict = None, status: IO = None, warning: IO = None, confoverrides: Dict = None, status: IO = None, warning: IO = None,
tags: List[str] = None, docutilsconf: str = None) -> None: tags: List[str] = None, docutilsconf: str = None, parallel: int = 0) -> None:
if docutilsconf is not None: if docutilsconf is not None:
(srcdir / 'docutils.conf').write_text(docutilsconf) (srcdir / 'docutils.conf').write_text(docutilsconf)
@ -133,7 +133,7 @@ class SphinxTestApp(application.Sphinx):
try: try:
super().__init__(srcdir, confdir, outdir, doctreedir, super().__init__(srcdir, confdir, outdir, doctreedir,
buildername, confoverrides, status, warning, buildername, confoverrides, status, warning,
freshenv, warningiserror, tags) freshenv, warningiserror, tags, parallel=parallel)
except Exception: except Exception:
self.cleanup() self.cleanup()
raise raise

View File

@ -421,6 +421,12 @@ def test_html5_output(app, cached_etree_parse, fname, expect):
check_xpath(cached_etree_parse(app.outdir / fname), fname, *expect) check_xpath(cached_etree_parse(app.outdir / fname), fname, *expect)
@pytest.mark.skipif(docutils.__version_info__ < (0, 13),
reason='docutils-0.13 or above is required')
@pytest.mark.sphinx('html', parallel=2)
def test_html_parallel(app):
app.build()
@pytest.mark.skipif(docutils.__version_info__ < (0, 13), @pytest.mark.skipif(docutils.__version_info__ < (0, 13),
reason='docutils-0.13 or above is required') reason='docutils-0.13 or above is required')
@pytest.mark.sphinx('html') @pytest.mark.sphinx('html')