--
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/066A99E3-B470-44C3-9632-F52E97AB8791%40wojtekmach.pl.
--
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/066A99E3-B470-44C3-9632-F52E97AB8791%40wojtekmach.pl.
On 27 Jun 2020, at 12:47, Devon Estes <devon....@gmail.com> wrote:
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAGowJcgGwFrF%2Btf%2BjmKnFSzntuVUX7pLb2Mj4jsvP6XyBXXo%2Bw%40mail.gmail.com.
Here is a proof of concept for the tag-based solution: https://gist.github.com/wojtekmach/2c59fb3c3c1c274e35d164014662975a
Of course it would be slightly different as part of ExUnit, but you get the idea. (And you can play with _this_ in your projects right now!)
On 27 Jun 2020, at 13:17, Wojtek Mach <woj...@wojtekmach.pl> wrote:
The downside of doing work in setup/0 is if you only need temp dir for one test, unless you mess with tags which adds boilerplate, you’d unnecessarily create dirs for tests that don’t need it. But then again you could argue that if you need it in just one test, do it in that test :) still I think it’s worth removing boilerplate.Contrary to the above mentioned golang issue, I am not super concerned about leaking temp directories, so I wasn’t planning to do that. Though being able to automatically remove those is arguably the only reason for tight integration with exunit. As you can see the implementation is currently fairly generic.I focused on the ex_unit case but a more general utility is interesting too.About @tag tmp_dir:@tag tmp_dir: truetest “foo”, %{tmp_dir: tmp_dir} doseems to strike a good balance between being explicit and easy enough to use. 👍
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-l...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/066A99E3-B470-44C3-9632-F52E97AB8791%40wojtekmach.pl.
----
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-l...@googlegroups.com.
What about supporting a new annotation @setup that can be used to call tmp_dir but also custom functions in the test suite, which would be useful to fine-tune setup for specific tests, especially for expensive setups. Eg:
@setup tmp_dir: "my_tmp_dir", :do_something_expensive
@tag :slow
test "my test B", context do
end
@tag is a filter (as stated by the doc), so enabling it to run setup/actions sounds like mixing up responsibilities and AFAIK it wouldn't be extensible to support custom setup functions like described above.
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/d7fb19b1-d06c-4587-a609-f07b3b7ff8b9o%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/0A935EC4-BBF3-4351-88AB-0B2EE800B7F1%40wojtekmach.pl.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAGowJcgiR%3DszA2fbZzx_FLNjvw2JLZ59N_xb%3DHfschnwwDoKdg%40mail.gmail.com.