(self, name: str, funcobj)
| 449 | return result |
| 450 | |
| 451 | def _genfunctions(self, name: str, funcobj) -> Iterator[Function]: |
| 452 | modulecol = self.getparent(Module) |
| 453 | assert modulecol is not None |
| 454 | module = modulecol.obj |
| 455 | clscol = self.getparent(Class) |
| 456 | cls = (clscol and clscol.obj) or None |
| 457 | |
| 458 | definition = FunctionDefinition.from_parent(self, name=name, callobj=funcobj) |
| 459 | fixtureinfo = definition._fixtureinfo |
| 460 | |
| 461 | # pytest_generate_tests impls call metafunc.parametrize() which fills |
| 462 | # metafunc._calls, the outcome of the hook. |
| 463 | metafunc = Metafunc( |
| 464 | definition=definition, |
| 465 | fixtureinfo=fixtureinfo, |
| 466 | config=self.config, |
| 467 | cls=cls, |
| 468 | module=module, |
| 469 | _ispytest=True, |
| 470 | ) |
| 471 | methods = [] |
| 472 | if hasattr(module, "pytest_generate_tests"): |
| 473 | methods.append(module.pytest_generate_tests) |
| 474 | if cls is not None and hasattr(cls, "pytest_generate_tests"): |
| 475 | methods.append(cls().pytest_generate_tests) |
| 476 | self.ihook.pytest_generate_tests.call_extra(methods, dict(metafunc=metafunc)) |
| 477 | |
| 478 | if not metafunc._calls: |
| 479 | yield Function.from_parent(self, name=name, fixtureinfo=fixtureinfo) |
| 480 | else: |
| 481 | metafunc._recompute_direct_params_indices() |
| 482 | # Direct parametrizations taking place in module/class-specific |
| 483 | # `metafunc.parametrize` calls may have shadowed some fixtures, so make sure |
| 484 | # we update what the function really needs a.k.a its fixture closure. Note that |
| 485 | # direct parametrizations using `@pytest.mark.parametrize` have already been considered |
| 486 | # into making the closure using `ignore_args` arg to `getfixtureclosure`. |
| 487 | fixtureinfo.prune_dependency_tree() |
| 488 | |
| 489 | for callspec in metafunc._calls: |
| 490 | subname = f"{name}[{callspec.id}]" if callspec._idlist else name |
| 491 | yield Function.from_parent( |
| 492 | self, |
| 493 | name=subname, |
| 494 | callspec=callspec, |
| 495 | fixtureinfo=fixtureinfo, |
| 496 | keywords={callspec.id: True}, |
| 497 | originalname=name, |
| 498 | ) |
| 499 | |
| 500 | |
| 501 | def importtestmodule( |
no test coverage detected