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

Method with_args

src/_pytest/mark/structures.py:384–391  ·  view source on GitHub ↗

Return a MarkDecorator with extra arguments added. Unlike calling the MarkDecorator, with_args() can be used even if the sole argument is a callable/class.

(self, *args: object, **kwargs: object)

Source from the content-addressed store, hash-verified

382 return self.name # for backward-compat (2.4.1 had this attr)
383
384 def with_args(self, *args: object, **kwargs: object) -> MarkDecorator:
385 """Return a MarkDecorator with extra arguments added.
386
387 Unlike calling the MarkDecorator, with_args() can be used even
388 if the sole argument is a callable/class.
389 """
390 mark = Mark(self.name, args, kwargs, _ispytest=True)
391 return MarkDecorator(self.mark.combined_with(mark), _ispytest=True)
392
393 # Type ignored because the overloads overlap with an incompatible
394 # return type. Not much we can do about that. Thankfully mypy picks

Callers 2

__call__Method · 0.95
test_mark_with_paramMethod · 0.80

Calls 3

MarkClass · 0.85
MarkDecoratorClass · 0.85
combined_withMethod · 0.80

Tested by 1

test_mark_with_paramMethod · 0.64