def test_initgroupsInStdlib(self):
        """
        Calling L{util.initgroups} will call the underlying stdlib
        implmentation.
        """
        calls = []

        def mockInitgroups(x, y):
            calls.append((x, y))

        self.patch(util, "_initgroups", mockInitgroups)
        setgroupsCalls = []
        self.patch(util, "setgroups", setgroupsCalls.append)

        util.initgroups(os.getuid(), 4)
        self.assertEqual(calls, [(pwd.getpwuid(os.getuid()).pw_name, 4)])
        self.assertFalse(setgroupsCalls)

        Calling L{util.initgroups} will call the underlying stdlib
        implmentation.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/python/test/test_util.py