Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML builder: toctree reliability during parallel builds #12886

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions tests/test_builders/test_build_html_toctree.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,30 @@ def test_relations(app):
assert 'quux' not in app.builder.relations


@pytest.mark.sphinx(
'html',
testroot='toctree-glob',
parallel=5,
confoverrides={'html_theme': 'alabaster'},
)
def test_parallel_toctree(app, cached_etree_parse):
app.build(force_all=True)

root = app.outdir / 'index.html'
bar1 = app.outdir / 'bar' / 'bar_1.html'

# top-level documents should only contain depth-1 navigation links
sidebar_xpath = ".//div[@class='sphinxsidebarwrapper']"
nested_links = f"{sidebar_xpath}//li[@class!='toctree-l1']/a"
check_xpath(cached_etree_parse(root), root.name, nested_links, None, be_found=False)

# nested documents should contain breadcrumbs for depths one and two
crumb1 = f"{sidebar_xpath}//li[@class='toctree-l1 current']/a"
crumb2 = f"{sidebar_xpath}//li[@class='toctree-l2 current']/a"
check_xpath(cached_etree_parse(bar1), bar1.name, crumb1, '^Bar$')
check_xpath(cached_etree_parse(bar1), bar1.name, crumb2, '^Bar-1$')


@pytest.mark.sphinx('singlehtml', testroot='toctree-empty')
def test_singlehtml_toctree(app):
app.build(force_all=True)
Expand Down
Loading