Backport bdd9513699cf to try to get tests working on the stable branch
Backport be05453abdd9 to try to get tests working on the stable branch