Skip to content

Commit fffa14e

Browse files
committed
fix(ci): Fix mypy error in tiered_testing.py
Use getattr for item.cls to avoid type error since Item doesn't have cls attribute in type stubs, only Function does.
1 parent 06fde62 commit fffa14e

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎src/sentry/testutils/pytest/tiered_testing.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,10 @@ def _get_test_tier(item: Item) -> str:
8282
return "tier2"
8383

8484
# Check class inheritance
85-
if item.cls is not None:
86-
for cls in item.cls.__mro__:
85+
# item.cls is available on Function items (test methods/functions)
86+
item_cls = getattr(item, "cls", None)
87+
if item_cls is not None:
88+
for cls in item_cls.__mro__:
8789
if cls.__name__ in SNUBA_BASE_CLASSES:
8890
return "tier2"
8991

0 commit comments

Comments
 (0)