示例#1
0
    def test_get_pid_of_external_process(self):
        process = self.create_python_process("import time; time.sleep(3)")
        expected_pid = process.pid

        _, library = dist.load()
        handle = OpenProcess(
            library.PROCESS_QUERY_INFORMATION, False, expected_pid)
        self.assertEqual(GetProcessId(handle), expected_pid)
        CloseHandle(handle)
示例#2
0
    def test_get_process_id_current_process(self):
        # We should be able to access the pid of the process
        # we created a handle to.
        _, library = dist.load()

        handle = OpenProcess(library.PROCESS_QUERY_INFORMATION, False,
                             os.getpid())
        self.assertEqual(GetProcessId(handle), os.getpid())
        CloseHandle(handle)
示例#3
0
 def test_handle_is_current_process(self):
     handle = GetCurrentProcess()
     self.assertEqual(GetProcessId(handle), os.getpid())