Fix unpickleable mocks causing test failures