Thursday, February 02, 2012

Chaos Python

Add this into your functional tests and smoke it.
import sys, random
def chaos_trace(frame, event, arg): 
    if event == 'line' and random.random() < 0.000001: 
        raise MemoryError()
    return chaos_trace
You will get some lovely random failures injected into your code. A great way to find bugs, and make sure your reasoning is sound in the face of CHAOS!


tito said...

Insane. :)

kcunning said...

I adore this. Going to see how this works with games in Python for sure!