Skip to content

Simplify fixture in tests/test_extensions/test_ext_apidoc.py by remov… #13695

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
11 changes: 4 additions & 7 deletions tests/test_extensions/test_ext_apidoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@


@pytest.fixture
def apidoc(rootdir, tmp_path, apidoc_params):
_, kwargs = apidoc_params
def apidoc(rootdir, tmp_path, apidoc_kwargs):
kwargs = apidoc_kwargs
coderoot = rootdir / kwargs.get('coderoot', 'test-root')
outdir = tmp_path / 'out'
excludes = [str(coderoot / e) for e in kwargs.get('excludes', [])]
Expand All @@ -37,16 +37,13 @@ def apidoc(rootdir, tmp_path, apidoc_params):


@pytest.fixture
def apidoc_params(request):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is currently in line with app_params(), perhaps worth maintaining the pattern?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As in just ditch this PR? I'm OK to do that

pargs = {}
def apidoc_kwargs(request):
kwargs = {}

for info in reversed(list(request.node.iter_markers('apidoc'))):
pargs |= dict(enumerate(info.args))
kwargs.update(info.kwargs)

args = [pargs[i] for i in sorted(pargs.keys())]
return args, kwargs
return kwargs


@pytest.mark.apidoc(coderoot='test-root')
Expand Down
Loading