You cannot virtualize OSX client versions earlier than 10.7 due to the Apple EULA (no product can do that legally). Server versions of 10.6 and (if I remember right) can be virtualized. You'll need a retail license of the OS to virtualize (the pre-installed version EULA doesn't allow it either). There's a thread here about how to purchase a 10.6 server copy for about $20 from Apple (if it's still available), but you're going to be out of luck on 10.5 if you don't already own one (or can find a real/legal one on ebay). Since 10.5 is way out of support by Apple, perhaps you can just drop that from your testing requirements....
As far as driving a VM with a python script, that I'm not sure about - you'd have to do something akin to screen scraping to pump user events to the VM. Best to try it with the trial version first.