diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-03-12 23:07:32 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-03-12 23:07:32 +0000 |
commit | 47562fa92998f8f4289ae9a8048349067754d52e (patch) | |
tree | c1643be8ab17fc607cea748a8bb1d621a5964873 /pw_cli/py/process_integration_test.py | |
parent | eeec55b65fe2c3c7647bb70ea44b3c839eb1267c (diff) | |
parent | 646563934a3e2ee26f50171f94d95173a1662e2c (diff) | |
download | pigweed-47562fa92998f8f4289ae9a8048349067754d52e.tar.gz |
Snap for 11566117 from 646563934a3e2ee26f50171f94d95173a1662e2c to sdk-releaseplatform-tools-35.0.1sdk-release
Change-Id: Iec629b181a2c6905754a4c340e334884e13fd3b4
Diffstat (limited to 'pw_cli/py/process_integration_test.py')
-rw-r--r-- | pw_cli/py/process_integration_test.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/pw_cli/py/process_integration_test.py b/pw_cli/py/process_integration_test.py index 3d05b1a1b..fa5873d30 100644 --- a/pw_cli/py/process_integration_test.py +++ b/pw_cli/py/process_integration_test.py @@ -21,8 +21,9 @@ from pw_cli import process import psutil # type: ignore - -FAST_TIMEOUT_SECONDS = 0.1 +# This timeout must be long enough to wait for the subprocess output, but +# fast enough that the test doesn't take terribly long in the success case. +FAST_TIMEOUT_SECONDS = 0.5 KILL_SIGNALS = set({-9, 137}) PYTHON = sys.executable @@ -44,8 +45,8 @@ class RunTest(unittest.TestCase): self.assertIn(result.returncode, KILL_SIGNALS) def test_timeout_kills_subprocess(self) -> None: - # Spawn a subprocess which waits for 100 seconds, print its pid, - # then wait for 100 seconds. + # Spawn a subprocess which prints its pid and then waits for 100 + # seconds. sleep_in_subprocess = textwrap.dedent( f""" import subprocess @@ -62,7 +63,7 @@ class RunTest(unittest.TestCase): PYTHON, '-c', sleep_in_subprocess, timeout=FAST_TIMEOUT_SECONDS ) self.assertIn(result.returncode, KILL_SIGNALS) - # THe first line of the output is the PID of the child sleep process. + # The first line of the output is the PID of the child sleep process. child_pid_str, sep, remainder = result.output.partition(b'\n') del sep, remainder child_pid = int(child_pid_str) |