It should be possible to mock a module so that a set of processes sees the mocked module and all other processes sees the original module. - mock:new(mymod, [{restrict, pid()}]): - only the caller pid() would hit the mocked module - or even better, all pids belonging to a specific application - Would enable mocking of the inet, gen_tcp modules etc