We read __code__ when setting a custom delivery object and when sending sessions in order to warn when a custom Delivery implementation doesn't have an options parameter
However, this breaks when using a Mock object as __code__ does not exist, nor can it be mocked
This PR adds a guard before reading __code__ so that we avoid a crash if it does not exist. We don't warn in this case as real delivery implementations should always have __code__ available, so a warning is likely to be just noise when running tests
Testing
Added a unit test using a Mock object for delivery
Goal
We read
__code__
when setting a custom delivery object and when sending sessions in order to warn when a custom Delivery implementation doesn't have anoptions
parameterHowever, this breaks when using a
Mock
object as__code__
does not exist, nor can it be mockedThis PR adds a guard before reading
__code__
so that we avoid a crash if it does not exist. We don't warn in this case as real delivery implementations should always have__code__
available, so a warning is likely to be just noise when running testsTesting
Added a unit test using a
Mock
object for delivery