Fix the unittest to run properly when the working directory has
additional bits set (such as the setgid or sticky bits).
Fixes Issue #20165: The unittest module no longer considers tests marked with
@expectedFailure successful if they pass.