Skip to content

Commit ac2ee4d

Browse files
authored
file tests: in the "tempname with parent" test, temporarily unset the TMPDIR environment variable while running the test (#43012)
1 parent 13afd74 commit ac2ee4d

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
@@ -106,13 +106,15 @@ using Random
106106
end
107107

108108
@testset "tempname with parent" begin
109-
t = tempname()
110-
@test dirname(t) == tempdir()
111-
mktempdir() do d
112-
t = tempname(d)
113-
@test dirname(t) == d
109+
withenv("TMPDIR" => nothing) do
110+
t = tempname()
111+
@test dirname(t) == tempdir()
112+
mktempdir() do d
113+
t = tempname(d)
114+
@test dirname(t) == d
115+
end
116+
@test_throws ArgumentError tempname(randstring())
114117
end
115-
@test_throws ArgumentError tempname(randstring())
116118
end
117119

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

0 commit comments

Comments
 (0)