Skip to content

Commit

Permalink
[refactor] Extract marker value function
Browse files Browse the repository at this point in the history
  • Loading branch information
ftnext committed Aug 6, 2024
1 parent 857b426 commit 52fad7d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,21 @@ def rootdir() -> Path:
return Path(__file__).parent / "roots"


def get_marker_value(request, marker_name: str):
marker = request.node.get_closest_marker(marker_name)
if marker is None:
raise RuntimeError(f"Mark as `{marker_name}`")
return marker.args[0]


@pytest.fixture
def parsed_built_html(
request,
make_app,
sphinx_test_tempdir: Path,
rootdir: Path,
):
marker = request.node.get_closest_marker("sphinx_build_in_tempdir")
if marker is None:
raise RuntimeError("Mark as `sphinx_build_in_tempdir`")
directory_name = marker.args[0]
directory_name = get_marker_value(request, "sphinx_build_in_tempdir")

srcdir = sphinx_test_tempdir / directory_name
if not srcdir.exists():
Expand Down

0 comments on commit 52fad7d

Please sign in to comment.