@@ -159,20 +159,15 @@ import .FakeTerminals.FakeTerminal
159159 end
160160
161161 dep8_path = git_init_package (tmp, joinpath (" packages" , " Dep8" ))
162- dep8_srcfile = joinpath (dep8_path, " src" , " Dep8.jl" )
163- function change_dep8 ()
164- # Modify the source to ensure it is recompiled
165- write (dep8_srcfile, read (dep8_srcfile, String) * " #" )
166- @info " updated Dep8.jl source file:" dep8_srcfile
167- println (read (dep8_srcfile, String))
168- end
162+ function clear_dep8_cache ()
163+ rm (joinpath (Pkg. depots1 (), " compiled" , " v$(VERSION . major) .$(VERSION . minor) " , " Dep8" ), force= true , recursive= true )
169164 @testset " delayed precompilation with do-syntax" begin
170165 iob = IOBuffer ()
171166 # Test that operations inside Pkg.precompile() do block don't trigger auto-precompilation
172167 Pkg. precompile (io= iob) do
173168 Pkg. add (Pkg. PackageSpec (path= dep8_path))
174169 Pkg. rm (" Dep8" )
175- change_dep8 ()
170+ clear_dep8_cache ()
176171 Pkg. add (Pkg. PackageSpec (path= dep8_path))
177172 end
178173
@@ -195,22 +190,25 @@ import .FakeTerminals.FakeTerminal
195190 @test Pkg. _autoprecompilation_enabled == false
196191
197192 # Operations should not trigger autoprecompilation when globally disabled
198- change_dep8 ()
193+ clear_dep8_cache ()
199194 Pkg. add (Pkg. PackageSpec (path= dep8_path), io= iob)
200195 @test ! occursin (" Precompiling" , String (take! (iob)))
201196
202197 # Manual precompile should still work
198+ @test Base. isprecompiled (Base. identify_package (" Dep8" )) == false
203199 Pkg. precompile (io= iob)
204200 @test occursin (" Precompiling" , String (take! (iob)))
201+ @test Base. isprecompiled (Base. identify_package (" Dep8" ))
205202
206203 # Re-enable autoprecompilation
207204 Pkg. autoprecompilation_enabled (true )
208205 @test Pkg. _autoprecompilation_enabled == true
209206
210207 # Operations should now trigger autoprecompilation again
211208 Pkg. rm (" Dep8" , io= iob)
212- change_dep8 ()
209+ clear_dep8_cache ()
213210 Pkg. add (Pkg. PackageSpec (path= dep8_path), io= iob)
211+ @test Base. isprecompiled (Base. identify_package (" Dep8" ))
214212 @test occursin (" Precompiling" , String (take! (iob)))
215213
216214 finally
0 commit comments