Skip to content

Commit 4173840

Browse files
Copilotev-br
andcommitted
Use pytest-provided item.cls instead of manual class access
Co-authored-by: ev-br <2133832+ev-br@users.noreply.github.com>
1 parent fa58c60 commit 4173840

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

conftest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,10 @@ def pytest_collection_modifyitems(config, items):
262262
if not hasattr(test_func, "_hypothesis_internal_settings_applied"):
263263
try:
264264
decorated_func = settings(max_examples=unvectorized_max_examples)(test_func)
265-
# For class methods, replace the function in the class
265+
# For class methods, use pytest's item.cls to access the class
266266
if inspect.ismethod(item.obj):
267-
# Get the class and method name
268-
setattr(item.obj.__self__.__class__, item.obj.__name__, decorated_func)
267+
# Use pytest-provided item.cls instead of manually accessing the class
268+
setattr(item.cls, item.obj.__name__, decorated_func)
269269
else:
270270
item.obj = decorated_func
271271
except InvalidArgument as e:

0 commit comments

Comments
 (0)