I don't see a strong need to make this part of ExUnit, especially because: 1. We should avoid mutating the global state in tests 2. We should avoid reading system environment variables in code (use config/runtime.exs instead)
Those can add to their own suites if necessary. :) On Wed, Mar 27, 2024 at 4:14 PM Daniel Kukula <daniel.k...@gmail.com> wrote: > Currently, tests that use env variables can't be run async because the > environment is shared. My proposal is to introduce a with_env function that > will accept a function to execute and a mapping of params that the > functions in System will accept as env variables: > Now: System.put_env("PORT", "4000") > assert some logic > System.delete_env("PORT") > > after > > with_env(%{"PORT" => "4000}, fn -> > assert some logic > end) > > -- > 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-core+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elixir-lang-core/3e7dcf24-ae69-47b0-a7b5-281055c70726n%40googlegroups.com > <https://groups.google.com/d/msgid/elixir-lang-core/3e7dcf24-ae69-47b0-a7b5-281055c70726n%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 elixir-lang-core+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4KJsNjCYX0QQvp%2BUKtAVdeUO76g%2BNAq55pyYxsxwrgfQQ%40mail.gmail.com.