Method
pytest_collection_modifyitems
(
self,
config: pytest.Config,
items: list[pytest.Item],
)
Source from the content-addressed store, hash-verified
| 234 | ) |
| 235 | |
| 236 | def pytest_collection_modifyitems( |
| 237 | self, |
| 238 | config: pytest.Config, |
| 239 | items: list[pytest.Item], |
| 240 | ) -> None: |
| 241 | # add the group name to nodeid as suffix if --dist=loadgroup |
| 242 | if config.getvalue("loadgroup"): |
| 243 | for item in items: |
| 244 | gnames: set[str] = set() |
| 245 | for mark in item.iter_markers("xdist_group"): |
| 246 | name = ( |
| 247 | mark.args[0] |
| 248 | if len(mark.args) > 0 |
| 249 | else mark.kwargs.get("name", "default") |
| 250 | ) |
| 251 | gnames.add(str(name)) |
| 252 | if not gnames: |
| 253 | continue |
| 254 | item._nodeid = f"{item.nodeid}@{'_'.join(sorted(gnames))}" |
| 255 | |
| 256 | @pytest.hookimpl |
| 257 | def pytest_collection_finish(self, session: pytest.Session) -> None: |
Tested by
no test coverage detected