Referencing external modules/functions in setup_all for tests

I rely on several calls to setup and setup_all in my ExUnit tests. This is a useful way to call several functions, e.g.

setup_all [:helper_function1, :helper_function2]

I’m wondering how I can reference other functions in other modules? E.g. if want to call TestHelpers.something how do I reference it in there?

1 Like

You can‘t. Setup functions need to be local (or imported).

1 Like

This is possible in ExUnit now (v1.15.0)

setup {MyModule, :my_setup_function}

https://hexdocs.pm/ex_unit/1.15.0/ExUnit.Callbacks.html#setup/1

1 Like