make python tests more robust