Test fix for 74e59ea

This fixes the backport PR #9899 causing test failures on 1.8.7.