I agree with Moshe, asserts should not be used for test code and twisted should run correctly in -O mode (which AFICT it does). In order to support this, places where "assert 0" is used for failure should be replaced with "raise RuntimeError".