MCPcopy
hub / github.com/pytest-dev/pytest / process_argname

Function process_argname

src/_pytest/fixtures.py:358–383  ·  view source on GitHub ↗
(argname: str)

Source from the content-addressed store, hash-verified

356 current_indices: dict[str, int] = {}
357
358 def process_argname(argname: str) -> Iterator[str]:
359 index = current_indices.get(argname)
360
361 # Optimization: already processed this argname.
362 if index == -1:
363 return
364
365 # Only yield each argname once.
366 if index is None:
367 yield argname
368 current_indices[argname] = -1
369
370 fixturedefs = getfixturedefs(argname)
371 if not fixturedefs:
372 return
373
374 index = current_indices.get(argname, -1)
375 if -index > len(fixturedefs):
376 # Exhausted the override chain (will error during runtest).
377 return
378 fixturedef = fixturedefs[index]
379
380 current_indices[argname] = index - 1
381 for dep in fixturedef.argnames:
382 yield from process_argname(dep)
383 current_indices[argname] = index
384
385 for argname in initialnames:
386 yield from process_argname(argname)

Callers 1

traverse_fixture_closureFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected