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

Method _matches_prefix_or_glob_option

src/_pytest/python.py:397–410  ·  view source on GitHub ↗

Check if the given name matches the prefix or glob-pattern defined in ini configuration.

(self, option_name: str, name: str)

Source from the content-addressed store, hash-verified

395 return self.classnamefilter(name) or self.isnosetest(obj)
396
397 def _matches_prefix_or_glob_option(self, option_name: str, name: str) -> bool:
398 """Check if the given name matches the prefix or glob-pattern defined
399 in ini configuration."""
400 for option in self.config.getini(option_name):
401 if name.startswith(option):
402 return True
403 # Check that name looks like a glob-string before calling fnmatch
404 # because this is called for every name in each collected module,
405 # and fnmatch is somewhat expensive to call.
406 elif ("*" in option or "?" in option or "[" in option) and fnmatch.fnmatch(
407 name, option
408 ):
409 return True
410 return False
411
412 def collect(self) -> Iterable[Union[nodes.Item, nodes.Collector]]:
413 if not getattr(self.obj, "__test__", True):

Callers 2

funcnamefilterMethod · 0.95
classnamefilterMethod · 0.95

Calls 1

getiniMethod · 0.45

Tested by

no test coverage detected