How to forbid all external requests for my tests?

I want to see a raised exception if any module tries to do a request.

I can stub :inet or :hackney with :meck, but maybe we have more general approach or a lib for this?

Like WebMock in ruby: WebMock.disable_net_connect!(allow_localhost: true)

Not that I am aware of. Perhaps run in a container without internet access or switch of your WiFi/pull ethernet cable.

Yes, eventually, the tests are going to run in container on ci stage, where they will fail.

I was looking for something to give developers a shorter feedback loop if they occasionally made an external request.

Elixir doesn’t do monkey patching so I don’t think it’s possible.

You’re better off testing in a local container anyway, closer to the project’s real-world conditions from earlier on.