Skip to content

Commit 40dca0f

Browse files
DilumAluthgeKristofferC
authored andcommitted
file tests: in the "tempname with parent" test, temporarily unset the TMPDIR environment variable while running the test (#43012)
(cherry picked from commit ac2ee4d)
1 parent 7617229 commit 40dca0f

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

test/file.jl

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,15 @@ using Random
9191
end
9292

9393
@testset "tempname with parent" begin
94-
t = tempname()
95-
@test dirname(t) == tempdir()
96-
mktempdir() do d
97-
t = tempname(d)
98-
@test dirname(t) == d
94+
withenv("TMPDIR" => nothing) do
95+
t = tempname()
96+
@test dirname(t) == tempdir()
97+
mktempdir() do d
98+
t = tempname(d)
99+
@test dirname(t) == d
100+
end
101+
@test_throws ArgumentError tempname(randstring())
99102
end
100-
@test_throws ArgumentError tempname(randstring())
101103
end
102104

103105
child_eval(code::String) = eval(Meta.parse(readchomp(`$(Base.julia_cmd()) -E $code`)))

0 commit comments

Comments
 (0)