Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/ex_unit/lib/ex_unit/runner.ex
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ defmodule ExUnit.Runner do
context
) do
spawn_monitor(fn ->
Process.set_label({test.case, test.name})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be overthinking this, but perhaps we could have an extra atom to make it distinguishable programmatically?

- Process.set_label({test.case, test.name})
+ Process.set_label({:ex_unit, test.case, test.name})

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought so but the module name should be self explanatory in most cases as it ends with Test by convention!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, although it doesn't cost much and also might have the benefit of grouping ex_unit tests together nicely if there is any sorting? Anyway, no strong opinion here 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sabiwara I saw this later. I like the idea. PR: Make this process label clearer

ExUnit.OnExitHandler.register(self())
generate_test_seed(seed, test, rand_algorithm)
context = context |> Map.merge(test.tags) |> Map.put(:test_pid, self())
Expand Down
8 changes: 8 additions & 0 deletions lib/ex_unit/test/ex_unit_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -1234,6 +1234,14 @@ defmodule ExUnitTest do
end
end

test "sets process label for each test" do
# TODO: Remove check once we support Erlang/OTP 27+
if function_exported?(:proc_lib, :get_label, 1) do
label = apply(:proc_lib, :get_label, [self()])
assert label == {ExUnitTest, :"test sets process label for each test"}
end
end

defp configure_and_reload_on_exit(opts) do
old_opts = ExUnit.configuration()

Expand Down