Skip to content

Commit 95265ba

Browse files
authored
ExUnit sets a process label for each test (#14758)
1 parent 0dd3985 commit 95265ba

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
@@ -440,6 +440,7 @@ defmodule ExUnit.Runner do
440440
context
441441
) do
442442
spawn_monitor(fn ->
443+
Process.set_label({test.case, test.name})
443444
ExUnit.OnExitHandler.register(self())
444445
generate_test_seed(seed, test, rand_algorithm)
445446
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)