Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
felix-hilden committed Apr 17, 2024
1 parent 15c4f14 commit e9944e3
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/src/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
# Extension options
codeautolink_autodoc_inject = True
codeautolink_custom_blocks = {"python3": None, "pycon3": clean_pycon}
suppress_warnings = ["config.cache"]

autodoc_default_options = {"members": True, "undoc-members": True}
autodoc_typehints = "description"
Expand Down
7 changes: 4 additions & 3 deletions tests/extension/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"""

any_whitespace = re.compile(r"\s*")
ref_tests = list(Path(__file__).with_name("ref").glob("*.txt"))
ref_tests = [(p.name, p) for p in Path(__file__).with_name("ref").glob("*.txt")]
ref_xfails = {
"ref_fluent_attrs.txt": sys.version_info < (3, 8),
"ref_fluent_call.txt": sys.version_info < (3, 8),
Expand All @@ -47,8 +47,8 @@ def assert_links(file: Path, links: list):
assert s == link


@pytest.mark.parametrize("file", ref_tests)
def test_references(file: Path, tmp_path: Path):
@pytest.mark.parametrize(("name", "file"), ref_tests)
def test_references(name: str, file: Path, tmp_path: Path):
"""
Basic extension tests for reference building.
Expand All @@ -72,6 +72,7 @@ def test_references(file: Path, tmp_path: Path):
links = []

files = {"conf.py": default_conf + conf, "index.rst": index}
print(f"Building file {name}.")
result_dir = _sphinx_build(tmp_path, "html", files)

assert_links(result_dir / "index.html", links)
Expand Down
1 change: 1 addition & 0 deletions tests/extension/ref/custom_block.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ def clean(s):
return s, s.replace("-*-", "")

codeautolink_custom_blocks = {"python": clean}
suppress_warnings = ["config.cache"]
# split
Test project
============
Expand Down
1 change: 1 addition & 0 deletions tests/extension/ref/custom_block_imported.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ test_project
test_project.bar
# split
codeautolink_custom_blocks = {"python": "parser_func.clean"}
suppress_warnings = ["config.cache"]
# split
Test project
============
Expand Down
1 change: 1 addition & 0 deletions tests/extension/ref/ref_extdoctest_doctest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ test_project.Foo
from sphinx_codeautolink.extension.block import clean_pycon
extensions.append("sphinx.ext.doctest")
codeautolink_custom_blocks = {"pycon3": clean_pycon}
suppress_warnings = ["config.cache"]
# split
Test project
============
Expand Down

0 comments on commit e9944e3

Please sign in to comment.