Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0ddaa96

Browse files
committed
simplify some file handling in test_extension.py
1 parent c46236b commit 0ddaa96

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

tests/test_extension.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222

2323
@pytest.mark.parametrize(
2424
"rst_file",
25-
[r.name for r in Path("tests/data").glob("*.rst")],
25+
Path("tests/data").glob("*.rst"),
2626
)
27-
def test_summarize_html(rst_file: str) -> None:
28-
rst = (PROJECT / "tests/data" / rst_file).read_text(encoding="utf-8")
29-
root = rst_file.removesuffix(".rst")
27+
def test_summarize_html(rst_file: Path) -> None:
28+
rst = rst_file.read_text(encoding="utf-8")
29+
root = rst_file.name.removesuffix(".rst")
3030
with in_tempdir():
3131
doctree = run_sphinx(rst, buildername="html", extensions=["linklint.ext"])
3232
summary = summarize_html_file("_build/index.html")
@@ -46,7 +46,7 @@ def test_summarize_html(rst_file: str) -> None:
4646
save_test_doctree(doctree)
4747

4848
assert 'class="self-link"' not in summary, f"Self-links found in {root}.html"
49-
summary_file = PROJECT / f"tests/data/{root}_summary.html"
49+
summary_file = Path(f"tests/data/{root}_summary.html")
5050
if summary_file.exists():
5151
expected = summary_file.read_text(encoding="utf-8")
5252
else:

0 commit comments

Comments
 (0)