Skip to content

Commit c61fa74

Browse files
JGulbronsonJosé Valim
authored and
José Valim
committed
Make ExUnit server timeout configurable
Signed-off-by: José Valim <[email protected]>
1 parent 805efd0 commit c61fa74

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

lib/ex_unit/lib/ex_unit.ex

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ defmodule ExUnit do
180180
and print them on test failure. Can be overridden for individual tests via
181181
`@tag capture_log: false`. Defaults to `false`.
182182
183+
* `:case_load_timeout` - the timeout to be used when loading a test case.
184+
Defaults to `60_000` milliseconds.
185+
183186
* `:colors` - a keyword list of colors to be used by some formatters.
184187
The only option so far is `[enabled: boolean]` which defaults to `IO.ANSI.enabled?/0`
185188

lib/ex_unit/lib/ex_unit/server.ex

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
defmodule ExUnit.Server do
22
@moduledoc false
3-
@timeout 60_000
43

54
use GenServer
65

@@ -21,11 +20,13 @@ defmodule ExUnit.Server do
2120
end
2221

2322
def take_async_cases(count) do
24-
GenServer.call(__MODULE__, {:take_async_cases, count}, @timeout)
23+
timeout = Application.fetch_env!(:ex_unit, :case_load_timeout)
24+
GenServer.call(__MODULE__, {:take_async_cases, count}, timeout)
2525
end
2626

2727
def take_sync_cases() do
28-
GenServer.call(__MODULE__, :take_sync_cases, @timeout)
28+
timeout = Application.fetch_env!(:ex_unit, :case_load_timeout)
29+
GenServer.call(__MODULE__, :take_sync_cases, timeout)
2930
end
3031

3132
## Callbacks

lib/ex_unit/mix.exs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ defmodule ExUnit.Mixfile do
1818
assert_receive_timeout: 100,
1919
autorun: true,
2020
capture_log: false,
21+
case_load_timeout: 60_000,
2122
colors: [],
2223
exclude: [],
2324
include: [],

0 commit comments

Comments
 (0)