python-chai fails to build with Python 3.15.0a3. ___________ StubTest.test_stub_property_with_obj_ref_for_the_setter ____________ self = <tests.stub_test.StubTest testMethod=test_stub_property_with_obj_ref_for_the_setter> @unittest.skipIf(IS_PYPY, "can't stub property setter in PyPy") def test_stub_property_with_obj_ref_for_the_setter(self): class Foo(object): @property def prop(self): return 3 > res = stub(Foo.prop.setter) ^^^^^^^^^^^^^^^^^^^^^ tests/stub_test.py:61: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ chai/stub.py:29: in stub return _stub_obj(obj) ^^^^^^^^^^^^^^ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ obj = <property object at 0x7fbbc41d1df0> def _stub_obj(obj): ''' Stub an object directly. ''' # Annoying circular reference requires importing here. Would like to see # this cleaned up. @AW from .mock import Mock # Return an existing stub if isinstance(obj, Stub): return obj # If a Mock object, stub its __call__ if isinstance(obj, Mock): return stub(obj.__call__) # If passed-in a type, assume that we're going to stub out the creation. # See StubNew for the awesome sauce. # if isinstance(obj, types.TypeType): if hasattr(types, 'TypeType') and isinstance(obj, types.TypeType): return StubNew(obj) elif hasattr(__builtins__, 'type') and \ isinstance(obj, __builtins__.type): return StubNew(obj) elif inspect.isclass(obj): return StubNew(obj) # I thought that types.UnboundMethodType differentiated these cases but # apparently not. if isinstance(obj, types.MethodType): # Handle differently if unbound because it's an implicit "any instance" if getattr(obj, 'im_self', None) is None: # Handle the python3 case and py2 filter if hasattr(obj, '__self__'): if obj.__self__ is not None: return StubMethod(obj) if sys.version_info.major == 2: return StubUnboundMethod(obj) else: return StubMethod(obj) # These aren't in the types library if type(obj).__name__ == 'method-wrapper': return StubMethodWrapper(obj) if type(obj).__name__ == 'wrapper_descriptor': raise UnsupportedStub( "must call stub(obj,'%s') for slot wrapper on %s", obj.__name__, obj.__objclass__.__name__) # (Mostly) Lastly, look for properties. # First look for the situation where there's a reference back to the # property. prop = obj if isinstance(getattr(obj, '__self__', None), property): obj = prop.__self__ # Once we've found a property, we have to figure out how to reference # back to the owning class. This is a giant pain and we have to use gc # to find out where it comes from. This code is dense but resolves to # something like this: # >>> gc.get_referrers( foo.x ) # [{'__dict__': <attribute '__dict__' of 'foo' objects>, # 'x': <property object at 0x7f68c99a16d8>, # '__module__': '__main__', # '__weakref__': <attribute '__weakref__' of 'foo' objects>, # '__doc__': None}] if isinstance(obj, property): klass, attr = None, None for ref in gc.get_referrers(obj): if klass and attr: break if isinstance(ref, dict) and ref.get('prop', None) is obj: klass = getattr( ref.get('__dict__', None), '__objclass__', None) for name, val in getattr(klass, '__dict__', {}).items(): if val is obj: attr = name break # In the case of PyPy, we have to check all types that refer to # the property, and see if any of their attrs are the property elif isinstance(ref, type): # Use dir as a means to quickly walk through the class tree for name in dir(ref): if getattr(ref, name) == obj: klass = ref attr = name break if klass and attr: rval = stub(klass, attr) if prop != obj: return stub(rval, prop.__name__) return rval # If a function and it has an associated module, we can mock directly. # Note that this *must* be after properties, otherwise it conflicts with # stubbing out the deleter methods and such # Sadly, builtin functions and methods have the same type, so we have to # use the same stub class even though it's a bit ugly if isinstance(obj, (types.FunctionType, types.BuiltinFunctionType, types.BuiltinMethodType)) and hasattr(obj, '__module__'): return StubFunction(obj) > raise UnsupportedStub("can't stub %s", obj) E chai.exception.UnsupportedStub: ("can't stub %s", <property object at 0x7fbbc41d1df0>) chai/stub.py:212: UnsupportedStub =========================== short test summary info ============================ FAILED tests/functional_test.py::FunctionalTest::test_properties_using_obj_ref_on_a_class_and_using_get_first FAILED tests/functional_test.py::FunctionalTest::test_properties_using_obj_ref_on_a_class_and_using_set_first FAILED tests/stub_test.py::StubTest::test_stub_property_with_obj_ref_for_the_deleter FAILED tests/stub_test.py::StubTest::test_stub_property_with_obj_ref_for_the_reader FAILED tests/stub_test.py::StubTest::test_stub_property_with_obj_ref_for_the_setter =================== 5 failed, 187 passed, 5 skipped in 0.19s =================== https://docs.python.org/3.15/whatsnew/3.15.html For the build logs, see: https://copr-be.cloud.fedoraproject.org/results/@python/python3.15/fedora-rawhide-x86_64/09935296-python-chai/ For all our attempts to build python-chai with Python 3.15, see: https://copr.fedorainfracloud.org/coprs/g/python/python3.15/package/python-chai/ Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.15: https://copr.fedorainfracloud.org/coprs/g/python/python3.15/ Let us know here if you have any questions. Python 3.15 is planned to be included in Fedora 45. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.15. A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon. We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.