| 267 | yield inst_or_fn |
| 268 | |
| 269 | def setup_test_classes(): |
| 270 | for test_class in test_classes: |
| 271 | # transfer legacy __backend__ and __sparse_backend__ symbols |
| 272 | # to be markers |
| 273 | if getattr(test_class.cls, "__backend__", False) or getattr( |
| 274 | test_class.cls, "__only_on__", False |
| 275 | ): |
| 276 | add_markers = {"backend"} |
| 277 | elif getattr(test_class.cls, "__sparse_backend__", False): |
| 278 | add_markers = {"sparse_backend", "backend"} |
| 279 | elif getattr(test_class.cls, "__sparse_driver_backend__", False): |
| 280 | add_markers = {"sparse_driver_backend", "backend"} |
| 281 | else: |
| 282 | add_markers = frozenset() |
| 283 | |
| 284 | existing_markers = { |
| 285 | mark.name for mark in test_class.iter_markers() |
| 286 | } |
| 287 | add_markers = add_markers - existing_markers |
| 288 | all_markers = existing_markers.union(add_markers) |
| 289 | |
| 290 | for marker in add_markers: |
| 291 | test_class.add_marker(marker) |
| 292 | |
| 293 | sub_tests = list( |
| 294 | plugin_base.generate_sub_tests( |
| 295 | test_class.cls, test_class.module, all_markers |
| 296 | ) |
| 297 | ) |
| 298 | if not sub_tests: |
| 299 | rebuilt_items[test_class.cls] |
| 300 | |
| 301 | for sub_cls in sub_tests: |
| 302 | if sub_cls is not test_class.cls: |
| 303 | per_cls_dict = rebuilt_items[test_class.cls] |
| 304 | |
| 305 | module = test_class.getparent(pytest.Module) |
| 306 | |
| 307 | new_cls = pytest.Class.from_parent( |
| 308 | name=sub_cls.__name__, parent=module |
| 309 | ) |
| 310 | for marker in add_markers: |
| 311 | new_cls.add_marker(marker) |
| 312 | |
| 313 | for fn in collect(new_cls): |
| 314 | per_cls_dict[fn.name].append(fn) |
| 315 | |
| 316 | # class requirements will sometimes need to access the DB to check |
| 317 | # capabilities, so need to do this for async |