wrapt
wrapt copied to clipboard
TestMonkeyPatching.test_wrap_class_method_inherited fails
It was already mentioned in #177, but without any solution offered. The TestMonkeyPatching.test_wrap_class_method_inherited test fails:
_____________ TestMonkeyPatching.test_wrap_class_method_inherited ______________
self = <test_monkey_patching.TestMonkeyPatching testMethod=test_wrap_class_method_inherited>
def test_wrap_class_method_inherited(self):
_args = (1, 2)
_kwargs = {'one': 1, 'two': 2}
called = []
def wrapper(wrapped, instance, args, kwargs):
called.append((args, kwargs))
self.assertEqual(args, _args)
self.assertEqual(kwargs, _kwargs)
return wrapped(*args, **kwargs)
wrapt.wrap_function_wrapper(__name__, 'Class_2_1.method',
wrapper)
> result = Class_2_1.method(*_args, **_kwargs)
tests/test_monkey_patching.py:226:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/test_monkey_patching.py:221: in wrapper
return wrapped(*args, **kwargs)
tests/test_monkey_patching.py:198: in wrapper
self.assertEqual(instance, Class_2)
/usr/lib/python3.9/vendor-packages/teamcity/diff_tools.py:33: in _patched_equals
old(self, first, second, msg)
E AssertionError: <class 'test_monkey_patching.Class_2_1'> != <class 'test_monkey_patching.Class_2'>
wrapt-1.14.1, Python 3.9.16.
Issue #177 was about the deprecation warnings which were dealt with. Try your tests with version 1.15.0. None of the tests in it fail like this.
1.15.0 fails too. The failure is not always reproducible and it looks like it is caused by the randomly pytest plugin. When I use PYTEST_ADDOPTS="-p no:randomly" all tests always pass.