Skip to content

Commit f80bd3c

Browse files
ericmjjosevalim
authored andcommitted
Fix intermittent test failure caused by archive warning (#10493)
1 parent 23934b4 commit f80bd3c

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

lib/mix/lib/mix/local.ex

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ defmodule Mix.Local do
3636
def path_for(:escript), do: Mix.path_for(:escripts)
3737

3838
@doc """
39-
Appends archives paths into Erlang code path.
39+
Appends archive paths to the Erlang code path.
4040
"""
4141
def append_archives do
4242
for archive <- archives_ebins() do
@@ -48,7 +48,18 @@ defmodule Mix.Local do
4848
end
4949

5050
@doc """
51-
Appends Mix paths into Erlang code path.
51+
Removes archive paths from Erlang code path.
52+
"""
53+
def remove_archives do
54+
for archive <- archives_ebins() do
55+
Code.delete_path(archive)
56+
end
57+
58+
:ok
59+
end
60+
61+
@doc """
62+
Appends Mix paths to the Erlang code path.
5263
"""
5364
def append_paths do
5465
Enum.each(mix_paths(), &Code.append_path(&1))

lib/mix/test/mix/tasks/archive_test.exs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ defmodule Mix.Tasks.ArchiveTest do
1919
File.rm_rf!(tmp_path("userhome"))
2020
System.put_env("MIX_ARCHIVES", tmp_path("userhome/.mix/archives/"))
2121
Mix.Project.push(ArchiveProject)
22-
:ok
22+
23+
on_exit(fn ->
24+
Mix.Local.remove_archives()
25+
System.delete_env("MIX_ARCHIVES")
26+
end)
2327
end
2428

2529
test "archive build" do

0 commit comments

Comments
 (0)