Thanks for the proposal. Perhaps it makes sense to run after_run in said cases as well. This way we can skip adding before_suite and make after_suite more consistent. WDYT?
On Fri, Feb 19, 2021 at 12:57 PM João Ferreira <[email protected]> wrote: > Hey all, > > I'd like to propose the complement to ExUnit.after_suite/1 which runs a > set of callbacks immediately before the test suite starts. > > We can set up code that's run before the test suite in test_helper.exs > but, unlike ExUnit.after_suite/1, this code runs regardless of there being > any actual tests to run as part of the suite. So if we *need* to tear > down some code that was set up in test_helper.exs but no tests are run, > we're out of luck. > > Here's a particular example: > > 1. Running an umbrella project with 2 apps > 2. mix test specific/file/in/app/1.ex > 3. Setup & tear-down happen correctly in app 1 suite > 4. Setup happens in app 2, but tear-down does not, because no files > match the given path, and after_suite callbacks don't run. > > Adding before_suite callbacks with the same semantics as after_suite would > be helpful here, since setup would only happen if there were any tests to > run. > > Cheers, > João > > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elixir-lang-core/884211ef-56dc-4a4b-b493-e8b67445e094n%40googlegroups.com > <https://groups.google.com/d/msgid/elixir-lang-core/884211ef-56dc-4a4b-b493-e8b67445e094n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4Lgv7kqr0WYiNqUs4BbB-ChcnpCxJ1S0g_o%2BD5y_dTjWg%40mail.gmail.com.
