Slide 11
Slide 11 text
Examples!
import logging, time
log = logging.getLogger('repro_steps')
def validate(operation, result, message):
log.info('verifying {}'.format(operation))
assert result, message
def test_abctastic():
'''Doing some math with a b and c.'''
a, b, c = 1, 2, 3
log.info('a, b, c = 1, 2, 3')
validate('a + b == c', a + b == c,
'expected {}, found {}'.format(a + b, c))
validate('c / b == 1.5', c / b == 1.5,
'expected 1.5, found {}'.format(c / b))
def test_sleepy():
'''A test that logs every .1 second for roughly a minute.'''
for i in xrange(600):
log.info('Message {}'.format(i))
time.sleep(.1)
Some setup code