Add python tests
Fix error handling and accumulation of exit codes