in reply to Embedding tests?

If it's for a module that normally would not run stand alone, you could do:
sub foo { ... } unless (caller) { ... your tests go here ... }
I think it's a common Python technique, but I may be mistaken.