MCPcopy Create free account
hub / github.com/pytest-dev/pytest / with_args

Method with_args

src/_pytest/mark/structures.py:332–339  ·  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

330 return self.name # for backward-compat (2.4.1 had this attr)
331
332 def with_args(self, *args: object, **kwargs: object) -> "MarkDecorator":
333 """Return a MarkDecorator with extra arguments added.
334
335 Unlike calling the MarkDecorator, with_args() can be used even
336 if the sole argument is a callable/class.
337 """
338 mark = Mark(self.name, args, kwargs, _ispytest=True)
339 return MarkDecorator(self.mark.combined_with(mark), _ispytest=True)
340
341 # Type ignored because the overloads overlap with an incompatible
342 # 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