def test_pid(self):
        """
        Simple test for the pid attribute of Process on win32.
        Launch process with mock win32process. The only mock aspect of this
        module is that the pid of the process created will always be 42.
        """
        from twisted.internet import _dumbwin32proc
        from twisted.test import mock_win32process
        self.patch(_dumbwin32proc, "win32process", mock_win32process)
        scriptPath = FilePath(__file__).sibling(u"process_cmdline.py").path
        pyExe = FilePath(sys.executable).asTextMode().path

        d = defer.Deferred()
        processProto = TrivialProcessProtocol(d)
        comspec = u"cmd.exe"
        cmd = [comspec, u"/c", pyExe, scriptPath]

        p = _dumbwin32proc.Process(
            reactor, processProto, None, cmd, {}, None)
        self.assertEqual(42, p.pid)
        self.assertEqual("<Process pid=42>", repr(p))

        def pidCompleteCb(result):
            self.assertIsNone(p.pid)
        return d.addCallback(pidCompleteCb)

        Simple test for the pid attribute of Process on win32.
        Launch process with mock win32process. The only mock aspect of this
        module is that the pid of the process created will always be 42.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_process.py