-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[refactor] Parametrize builder to make DRY
- Loading branch information
Showing
4 changed files
with
27 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import shutil | ||
|
||
import pytest | ||
from bs4 import BeautifulSoup | ||
|
||
|
||
@pytest.mark.parametrize("builder", ["html", "singlehtml", "dirhtml"]) | ||
def test_internal_link_should_not_open_new_tab( | ||
make_app, sphinx_test_tempdir: str, rootdir: str, builder: str | ||
): | ||
testroot = "default" | ||
srcdir = sphinx_test_tempdir / testroot | ||
if not srcdir.exists(): | ||
testroot_path = rootdir / f"test-{testroot}" | ||
shutil.copytree(testroot_path, srcdir) | ||
|
||
app = make_app(builder, srcdir=srcdir) | ||
app.build() | ||
|
||
html = (app.outdir / "index.html").read_text() | ||
soup = BeautifulSoup(html, "html.parser") | ||
references = soup.find_all("a", {"class": "reference"}) | ||
|
||
ref = references[-1] | ||
assert "internal" in ref["class"] | ||
assert "target" not in ref.attrs | ||
assert "rel" not in ref.attrs |