diff options
| author | Scott Gasch <[email protected]> | 2022-06-04 09:06:07 -0700 |
|---|---|---|
| committer | Scott Gasch <[email protected]> | 2022-06-04 09:06:07 -0700 |
| commit | e8cfdd16192b40c460a620cf04e2667b3020e5ac (patch) | |
| tree | 3a25587518c9d3b48e13f02ec70a86783a763080 /tests | |
| parent | bf6386e82fcc7f0be1b15891e56d60ed818926e2 (diff) | |
Add timeout_seconds to cmd_showing_output.
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/exec_utils_test.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/exec_utils_test.py b/tests/exec_utils_test.py index 4c003aa..11dda89 100755 --- a/tests/exec_utils_test.py +++ b/tests/exec_utils_test.py @@ -4,6 +4,7 @@ """exec_utils unittest.""" +import subprocess import unittest import exec_utils @@ -18,6 +19,14 @@ class TestExecUtils(unittest.TestCase): self.assertEqual(0, ret) record().close() + def test_cmd_showing_output_with_timeout(self): + try: + exec_utils.cmd_showing_output('sleep 10', timeout_seconds=0.1) + except subprocess.TimeoutExpired: + pass + else: + self.fail('Expected a TimeoutException, didn\'t see one.') + def test_cmd_showing_output_fails(self): with unittest_utils.RecordStdout() as record: ret = exec_utils.cmd_showing_output('/usr/bin/printf hello && false') |
