def test_addProcessDuplicateKeyError(self):
        """
        L{ProcessMonitor.addProcess} raises a C{KeyError} if a process with the
        given name already exists.
        """
        self.pm.addProcess("foo", ["arg1", "arg2"],
                           uid=1, gid=2, env={})
        self.assertRaises(KeyError, self.pm.addProcess,
                          "foo", ["arg1", "arg2"], uid=1, gid=2, env={})

        L{ProcessMonitor.addProcess} raises a C{KeyError} if a process with the
        given name already exists.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/runner/test/test_procmon.py