zopefoundation / zope.testing

Other
4 stars 13 forks source link

Allow a callable to be passed as the `message` argument to `wait` #21

Open jimfulton opened 6 years ago

jimfulton commented 6 years ago

To allow debugging information to be included in failure exceptions. This would play the same role as the expression in an assert statement.

icemac commented 6 years ago

@jimfulton Could you provide a code example? I have no idea what you mean.

jimfulton commented 6 years ago
wait((lambda : foo == 0), message=lambda : 'foo non-zero: {}'.format(foo))

Note that this allows us to see what foo actually is, without having to resort to pdb.

icemac commented 6 years ago

Ah, you seem to be talking about https://github.com/zopefoundation/zope.testing/blob/master/src/zope/testing/wait.py. Sorry for my ignorance, I did not even know that this module exists.