diff --git a/lib/elixir/test/elixir/process_test.exs b/lib/elixir/test/elixir/process_test.exs index bd7e45d94ab..dcca57ddfc9 100644 --- a/lib/elixir/test/elixir/process_test.exs +++ b/lib/elixir/test/elixir/process_test.exs @@ -63,7 +63,7 @@ defmodule ProcessTest do test "sleep/1 with 2^32" do {pid, monitor_ref} = spawn_monitor(fn -> Process.sleep(2 ** 32) end) - refute_receive {:DOWN, ^monitor_ref, :process, ^pid, {:timeout_value, _trace}} + refute_receive {:DOWN, ^monitor_ref, :process, ^pid, {:timeout_value, _trace}}, 100 Process.exit(pid, :kill) end @@ -130,7 +130,7 @@ defmodule ProcessTest do end) true = Process.exit(pid, :normal) - refute_receive {:EXIT, ^pid, :normal} + refute_receive {:EXIT, ^pid, :normal}, 100 assert Process.alive?(pid) # now exit the process for real so it doesn't hang around diff --git a/lib/elixir/test/elixir/stream_test.exs b/lib/elixir/test/elixir/stream_test.exs index 47c0b771d92..ed62a1cfa40 100644 --- a/lib/elixir/test/elixir/stream_test.exs +++ b/lib/elixir/test/elixir/stream_test.exs @@ -318,14 +318,14 @@ defmodule StreamTest do send(pid, {:stream, 1}) send(pid, {:stream, 2}) send(pid, {:stream, 3}) - refute_receive {:stream, 1} + refute_receive {:stream, 1}, 100 send(pid, {:stream, 4}) assert_receive {:stream, 1} send(pid, {:stream, 5}) assert_receive {:stream, 2} - refute_receive {:stream, 3} + refute_receive {:stream, 3}, 100 end test "drop_every/2" do diff --git a/lib/elixir/test/elixir/test_helper.exs b/lib/elixir/test/elixir/test_helper.exs index 0b233cf8dec..16df79ae49f 100644 --- a/lib/elixir/test/elixir/test_helper.exs +++ b/lib/elixir/test/elixir/test_helper.exs @@ -100,7 +100,6 @@ defmodule CodeFormatterHelpers do end end -assert_timeout = String.to_integer(System.get_env("ELIXIR_ASSERT_TIMEOUT") || "500") epmd_exclude = if match?({:win32, _}, :os.type()), do: [epmd: true], else: [] os_exclude = if PathHelpers.windows?(), do: [unix: true], else: [windows: true] @@ -135,9 +134,9 @@ cover_exclude = ExUnit.start( trace: !!System.get_env("TRACE"), - assert_receive_timeout: assert_timeout, exclude: epmd_exclude ++ os_exclude ++ line_exclude ++ distributed_exclude ++ source_exclude ++ cover_exclude, - include: line_include + include: line_include, + assert_receive_timeout: String.to_integer(System.get_env("ELIXIR_ASSERT_TIMEOUT", "300")) ) diff --git a/lib/ex_unit/examples/one_of_each.exs b/lib/ex_unit/examples/one_of_each.exs index 77d8e36334d..cd7b40d30c8 100644 --- a/lib/ex_unit/examples/one_of_each.exs +++ b/lib/ex_unit/examples/one_of_each.exs @@ -104,7 +104,7 @@ defmodule TestOneOfEach do test "19. refute a message is received within a timeout" do send(self(), {:hello, "Dave"}) - refute_receive {:hello, _}, 1000 + refute_receive {:hello, _}, 100 end test "20. refute a message is ready to be received" do diff --git a/lib/ex_unit/test/ex_unit/assertions_test.exs b/lib/ex_unit/test/ex_unit/assertions_test.exs index 23096bfec7f..7254edd5e5a 100644 --- a/lib/ex_unit/test/ex_unit/assertions_test.exs +++ b/lib/ex_unit/test/ex_unit/assertions_test.exs @@ -601,7 +601,7 @@ defmodule ExUnit.AssertionsTest do end test "refute receive waits" do - false = refute_receive :hello + false = refute_receive :hello, 100 end test "refute received when equal" do diff --git a/lib/ex_unit/test/ex_unit/capture_log_test.exs b/lib/ex_unit/test/ex_unit/capture_log_test.exs index 18bdea7bc98..2b637f79140 100644 --- a/lib/ex_unit/test/ex_unit/capture_log_test.exs +++ b/lib/ex_unit/test/ex_unit/capture_log_test.exs @@ -102,7 +102,7 @@ defmodule ExUnit.CaptureLogTest do Logger.error("oh no!") end) - refute_receive {:EXIT, _, _} + refute_receive {:EXIT, _, _}, 100 end describe "with_log/2" do diff --git a/lib/ex_unit/test/test_helper.exs b/lib/ex_unit/test/test_helper.exs index 57db58b5898..c34253f7708 100644 --- a/lib/ex_unit/test/test_helper.exs +++ b/lib/ex_unit/test/test_helper.exs @@ -13,5 +13,6 @@ CoverageRecorder.maybe_record("ex_unit") ExUnit.start( trace: !!System.get_env("TRACE"), include: line_include, - exclude: line_exclude + exclude: line_exclude, + assert_receive_timeout: String.to_integer(System.get_env("ELIXIR_ASSERT_TIMEOUT", "300")) ) diff --git a/lib/iex/test/test_helper.exs b/lib/iex/test/test_helper.exs index 0e4989bdb5d..d67da59c7a5 100644 --- a/lib/iex/test/test_helper.exs +++ b/lib/iex/test/test_helper.exs @@ -7,8 +7,6 @@ path = Path.expand("../tmp/beams", __DIR__) File.rm_rf!(path) File.mkdir_p!(path) Code.prepend_path(path) - -assert_timeout = String.to_integer(System.get_env("ELIXIR_ASSERT_TIMEOUT") || "500") System.put_env("ELIXIR_EDITOR", "echo") {:ok, _} = Application.ensure_all_started(:iex) @@ -42,10 +40,10 @@ cover_exclude = end ExUnit.start( - assert_receive_timeout: assert_timeout, trace: !!System.get_env("TRACE"), include: line_include, - exclude: line_exclude ++ erlang_doc_exclude ++ source_exclude ++ cover_exclude + exclude: line_exclude ++ erlang_doc_exclude ++ source_exclude ++ cover_exclude, + assert_receive_timeout: String.to_integer(System.get_env("ELIXIR_ASSERT_TIMEOUT", "300")) ) defmodule IEx.Case do diff --git a/lib/logger/test/logger/translator_test.exs b/lib/logger/test/logger/translator_test.exs index dd54eae6a18..0ac0f66d229 100644 --- a/lib/logger/test/logger/translator_test.exs +++ b/lib/logger/test/logger/translator_test.exs @@ -1275,7 +1275,7 @@ defmodule Logger.TranslatorTest do test "drops events if otp report handling is switched off" do {:ok, pid} = GenServer.start(MyGenServer, :ok) catch_exit(GenServer.call(pid, :error)) - refute_receive {:event, _, _}, 200 + refute_receive {:event, _, _}, 100 end def task(parent, fun \\ fn -> raise "oops" end) do diff --git a/lib/logger/test/test_helper.exs b/lib/logger/test/test_helper.exs index 5ef0f215ffb..3d623846e1a 100644 --- a/lib/logger/test/test_helper.exs +++ b/lib/logger/test/test_helper.exs @@ -11,7 +11,8 @@ CoverageRecorder.maybe_record("logger") ExUnit.start( trace: !!System.get_env("TRACE"), include: line_include, - exclude: line_exclude + exclude: line_exclude, + assert_receive_timeout: String.to_integer(System.get_env("ELIXIR_ASSERT_TIMEOUT", "300")) ) defmodule Logger.Case do diff --git a/lib/mix/test/mix/dep_test.exs b/lib/mix/test/mix/dep_test.exs index 332838b91e7..38745857019 100644 --- a/lib/mix/test/mix/dep_test.exs +++ b/lib/mix/test/mix/dep_test.exs @@ -946,7 +946,7 @@ defmodule Mix.DepTest do Mix.Tasks.Deps.Get.run([]) Mix.Tasks.Deps.Compile.run([]) - refute_receive {:mix_shell, :error, ["Could not compile :git_repo" <> _]} + refute_receive {:mix_shell, :error, ["Could not compile :git_repo" <> _]}, 100 end) end) end diff --git a/lib/mix/test/mix/umbrella_test.exs b/lib/mix/test/mix/umbrella_test.exs index 37303777352..697aec41642 100644 --- a/lib/mix/test/mix/umbrella_test.exs +++ b/lib/mix/test/mix/umbrella_test.exs @@ -375,7 +375,7 @@ defmodule Mix.UmbrellaTest do Mix.Task.run("compile", ["--verbose"]) assert_receive {:mix_shell, :info, ["no compile bar"]} - refute_receive {:mix_shell, :info, ["Compiled lib/bar.ex"]} + refute_receive {:mix_shell, :info, ["Compiled lib/bar.ex"]}, 100 end) end) end diff --git a/lib/mix/test/test_helper.exs b/lib/mix/test/test_helper.exs index fcf9e80f771..2acc66374ba 100644 --- a/lib/mix/test/test_helper.exs +++ b/lib/mix/test/test_helper.exs @@ -49,7 +49,8 @@ CoverageRecorder.maybe_record("mix") ExUnit.start( trace: !!System.get_env("TRACE"), exclude: epmd_exclude ++ os_exclude ++ git_exclude ++ line_exclude ++ cover_exclude, - include: line_include + include: line_include, + assert_receive_timeout: String.to_integer(System.get_env("ELIXIR_ASSERT_TIMEOUT", "300")) ) defmodule MixTest.Case do