jjh42/mock

Can't mock Task

Closed this issue · 2 comments

Hey, not sure if I missed something obvious but I can't seem to mock Task.

with_mock Task, [start: fn(_) -> end] do
end

Results in...

14:19:07.262 [error] GenServer #PID<0.233.0> terminating
** (stop) killed
Last message: {:EXIT, #PID<0.220.0>, :killed}
State: {:state, {#PID<0.233.0>, Supervisor.Default}, :simple_one_for_one, [{:child, :undefined, GenServer, {GenServer, :start_link, []}, :temporary, 5000, :worker, [GenServer]}], {:set, {:set, 2, 16, 16, 8, 80, 48, {[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []}, {{[], [#PID<0.241.0>], [], [], [], [], [], [], [], [], [], [#PID<0.235.0>], [], [], [], []}}}}, 3, 5, [], 0, Supervisor.Default, {[%{id: GenServer, restart: :temporary, start: {GenServer, :start_link, []}}], [strategy: :simple_one_for_one]}}

Am I doing something silly?

Nothing silly, but without digging dipper, I'd be hesitant to mock Task. It's a pretty fundamental elixir module which could very well (I'm completely guessing) be used by ExUnit.

Ah, now that you say that, it makes perfect sense. I didn't even think to check. I'll close this for now and looking into it myself, thanks!