Skip to content

Commit bbcd7f3

Browse files
nathanljosevalim
authored andcommitted
ExUnit sets a process label for each test (#14758)
1 parent 51ac9bc commit bbcd7f3

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

lib/ex_unit/lib/ex_unit/runner.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,7 @@ defmodule ExUnit.Runner do
435435
context
436436
) do
437437
spawn_monitor(fn ->
438+
Process.set_label({test.case, test.name})
438439
ExUnit.OnExitHandler.register(self())
439440
generate_test_seed(seed, test, rand_algorithm)
440441
context = context |> Map.merge(test.tags) |> Map.put(:test_pid, self())

lib/ex_unit/test/ex_unit_test.exs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,6 +1234,14 @@ defmodule ExUnitTest do
12341234
end
12351235
end
12361236

1237+
test "sets process label for each test" do
1238+
# TODO: Remove check once we support Erlang/OTP 27+
1239+
if function_exported?(:proc_lib, :get_label, 1) do
1240+
label = apply(:proc_lib, :get_label, [self()])
1241+
assert label == {ExUnitTest, :"test sets process label for each test"}
1242+
end
1243+
end
1244+
12371245
defp configure_and_reload_on_exit(opts) do
12381246
old_opts = ExUnit.configuration()
12391247

0 commit comments

Comments
 (0)