excluding unit test code

Michael Hudson mwh21 at cam.ac.uk
Tue Apr 3 04:09:52 EDT 2001


"David Allen" <mda at idatar.com> writes:

> What do you mean by "exclude"?  If this were C, 
> I'd say that you could just use "#if 0" around the
> test blocks for when you ship production code.
> 
> The quick way is to convert:
> 
> some_test_code()
> 
> into
> 
> if None:
>   some_test_code()
> 
> if that's OK with you.  That way it will never be
> executed.

If you change "if None:" into "if 0:", then it won't even be compiled!

Cheers,
M.

-- 
  SCSI is not magic. There are fundamental technical reasons why it
  is necessary to sacrifice a young goat to your SCSI chain now and
  then.                                                  -- John Woods



More information about the Python-list mailing list