diff --git a/test/path.jl b/test/path.jl
index 4c2c7034577d5..2515d765d8ca9 100644
--- a/test/path.jl
+++ b/test/path.jl
@@ -312,7 +312,14 @@
end
@testset "uripath" begin
- host = if Sys.iswindows() "" else gethostname() end
+ host = if Sys.iswindows()
+ ""
+ elseif ispath("/proc/sys/fs/binfmt_misc/WSLInterop")
+ distro = get(ENV, "WSL_DISTRO_NAME", "") # See
+ "wsl%24/$distro" # See and
+ else
+ gethostname()
+ end
sysdrive, uridrive = if Sys.iswindows() "C:\\", "C:/" else "/", "" end
@test Base.Filesystem.uripath("$(sysdrive)some$(sep)file.txt") == "file://$host/$(uridrive)some/file.txt"
@test Base.Filesystem.uripath("$(sysdrive)another$(sep)$(sep)folder$(sep)file.md") == "file://$host/$(uridrive)another/folder/file.md"