Issue/10991 stable7 backport

Stable7 backport of #12218

Together with #12288 it makes tests pass on windows :sunglasses: 

Commit 39ae569c5cafda5e15865699ff17b9734020329e is missing, as the files do not exist in stable7

@MorrisJobke @PVince81 @schiesbn @th3fallen