How to spy on Mock-wrapped method calls in Python

You have a class whose API you want to verify:

    class Class_A(object):
        def method_X(self):

        def method_Y(self):

You write the following test fully expecting it to pass. Alas, the method_Y assertion fails.

    def test_class_a(self):
        obj = Class_A()
        mock = MagicMock(spec_set=obj, wraps=obj)


This is because the Python Unittest Mock, while wrapping mock.method_X(), Mock uses obj in the __self__ of the method_Y binding. As a result the self value passed to method_X is that of the obj and not mock and the call to method_Y is therefore invisible to the Mock.

Continue reading “How to spy on Mock-wrapped method calls in Python”

JBOSGi 2.4.0.Final for WildFly 9 Released!

I am pleased to announce the release of JBOSGi 2.4.0.Final for WildFly 9.

This release targets WildFly 9.0.2 but should be compatible with all WildFly 9 minor releases, and contains OSGi component upgrades and WildFly 9 integration changes.

Continue reading “JBOSGi 2.4.0.Final for WildFly 9 Released!”

JBOSGi 2.3.1.Final for WildFly 8.2.x Released

Announcing the release of JBOSGi 2.3.1.Final for WildFly 8.2.x.

This release contains stability improvements, enhances operating system compatibility and increases integration with WildFly module system.

Continue reading “JBOSGi 2.3.1.Final for WildFly 8.2.x Released”