Backport #12181

This should fix the stable7 unit tests again since the last CI update.