Skip to content

Commit 65681b8

Browse files
michallepickijosevalim
authored andcommitted
Skip tests using Rebar2 on Erlang/OTP 25+ (#11643)
* Skip tests using Rebar2 on Erlang/OTP 25+ and clean up mix test_helper.exs exclude filters * Remove unnecessary printing from mix test_helper.exs exclude filters
1 parent 63d682b commit 65681b8

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

lib/mix/test/mix/rebar_test.exs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ defmodule Mix.RebarTest do
202202

203203
# We run only on Unix because Windows has a hard time
204204
# removing the Rebar executable after executed.
205-
@tag [unix: true]
205+
@tag :unix
206206
test "gets and compiles dependencies" do
207207
in_tmp("get and compile dependencies", fn ->
208208
Mix.Project.push(RebarAsDep)
@@ -256,7 +256,7 @@ defmodule Mix.RebarTest do
256256

257257
# We run only on Unix because Windows has a hard time
258258
# removing the Rebar executable after executed.
259-
@tag [unix: true]
259+
@tag :unix
260260
test "applies variables from :system_env option when compiling dependencies" do
261261
in_tmp("applies variables from system_env", fn ->
262262
Mix.Project.push(RebarAsDepWithEnv)
@@ -295,6 +295,7 @@ defmodule Mix.RebarTest do
295295
File.rm(MixTest.Case.tmp_path("rebar_dep/mix.exs"))
296296
end
297297

298+
@tag :rebar
298299
test "gets and compiles dependencies with Rebar2" do
299300
in_tmp("get and compile dependencies for Rebar2", fn ->
300301
Mix.Project.push(Rebar2AsDep)
@@ -328,7 +329,8 @@ defmodule Mix.RebarTest do
328329

329330
# We run only on Unix because Windows has a hard time
330331
# removing the Rebar executable after executed.
331-
@tag [unix: true]
332+
@tag :unix
333+
@tag :rebar
332334
test "applies variables from :system_env option when compiling dependencies for Rebar2" do
333335
in_tmp("applies variables from system_env for Rebar2", fn ->
334336
Mix.Project.push(Rebar2AsDep)

lib/mix/test/test_helper.exs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ Application.put_env(:logger, :backends, [])
77

88
os_exclude = if match?({:win32, _}, :os.type()), do: [unix: true], else: [windows: true]
99
epmd_exclude = if match?({:win32, _}, :os.type()), do: [epmd: true], else: []
10-
ExUnit.start(trace: "--trace" in System.argv(), exclude: epmd_exclude ++ os_exclude)
10+
git_exclude = if Mix.SCM.Git.git_version() <= {1, 7, 4}, do: [git_sparse: true], else: []
11+
rebar_exclude = if System.otp_release() >= "25", do: [rebar: true], else: []
1112

12-
unless {1, 7, 4} <= Mix.SCM.Git.git_version() do
13-
IO.puts(:stderr, "Skipping tests with git sparse checkouts...")
14-
ExUnit.configure(exclude: :git_sparse)
15-
end
13+
ExUnit.start(
14+
trace: "--trace" in System.argv(),
15+
exclude: epmd_exclude ++ os_exclude ++ git_exclude ++ rebar_exclude
16+
)
1617

1718
# Clear environment variables that may affect tests
1819
System.delete_env("http_proxy")

0 commit comments

Comments
 (0)