You could then use exit 1 from the script and Travis will detect the bad exit code and mark the build as failed – of course, if the traceback error causes the testing process to exit with a non-zero exit status, then you can just make sure you’re running the command from the script section of your Travis config and then Travis will pick up the failed test and mark the build as failed.