Python has a unit test framework, and there is a pyexpect package if it comes to that; don't know how hard it would be to integrate the latter into the former.