Proposal: allow for tagging Doctests

15 views
Skip to first unread message

Devon Estes

unread,
Jan 27, 2020, 10:45:33 AM1/27/20
to elixir-lang-core
I have some Doctests that emit logs, and I don't want that stuff clogging up my terminal, so I would like to be able to tag those with `:capture_log` like I can with other tests.

What do folks think about something like this, which would apply that tag to all doctests generated with that call to the `doctest/2` macro:

```elixir
defmodule PostTest do
  use ExUnit.Case

  @tag :capture_log
  doctest Post

  test "is a test" do
    # ...
  end
end
```

Alternatively, we could apply tags with options to the macro call, like so:

```elixir
defmodule PostTest do
  use ExUnit.Case

  doctest Post, import: true, tags: [capture_log: true]

  test "is a test" do
    # ...
  end
end
```

José Valim

unread,
Jan 27, 2020, 10:48:02 AM1/27/20
to elixir-l...@googlegroups.com
We can definitely support the option based synytax. PRs are welcome.

--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/a66afb3a-9a2c-46ab-bbf0-92b6c0067fa6%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages