(self)
| 3509 | self.assertEqual(returncode, -3) |
| 3510 | |
| 3511 | def test_send_signal_race(self): |
| 3512 | # bpo-38630: send_signal() must poll the process exit status to reduce |
| 3513 | # the risk of sending the signal to the wrong process. |
| 3514 | proc = subprocess.Popen(ZERO_RETURN_CMD) |
| 3515 | |
| 3516 | # wait until the process completes without using the Popen APIs. |
| 3517 | support.wait_process(proc.pid, exitcode=0) |
| 3518 | |
| 3519 | # returncode is still None but the process completed. |
| 3520 | self.assertIsNone(proc.returncode) |
| 3521 | |
| 3522 | with mock.patch("os.kill") as mock_kill: |
| 3523 | proc.send_signal(signal.SIGTERM) |
| 3524 | |
| 3525 | # send_signal() didn't call os.kill() since the process already |
| 3526 | # completed. |
| 3527 | mock_kill.assert_not_called() |
| 3528 | |
| 3529 | # Don't check the returncode value: the test reads the exit status, |
| 3530 | # so Popen failed to read it and uses a default returncode instead. |
| 3531 | self.assertIsNotNone(proc.returncode) |
| 3532 | |
| 3533 | def test_send_signal_race2(self): |
| 3534 | # bpo-40550: the process might exist between the returncode check and |
nothing calls this directly
no test coverage detected