Commit 8f8011d8 by Jörg Stucke

added test for new parameter

parent 2db6987c
import os import os
import unittest import unittest
from subprocess import CalledProcessError
from time import time from time import time
from common_helper_files import get_dir_of_file from common_helper_files import get_dir_of_file
...@@ -30,6 +31,12 @@ class TestProcessHelperPublic(unittest.TestCase): ...@@ -30,6 +31,12 @@ class TestProcessHelperPublic(unittest.TestCase):
self.assertEqual(output, 'test 123\n', 'result not correct') self.assertEqual(output, 'test 123\n', 'result not correct')
self.assertEqual(rc, 2, 'return code not correct') self.assertEqual(rc, 2, 'return code not correct')
def test_execute_shell_command_with_check(self):
with self.assertRaises(CalledProcessError):
execute_shell_command("exit 1", check=True)
with self.assertRaises(CalledProcessError):
execute_shell_command("exit 255", check=True)
def test_execute_shell_command_time_out(self): def test_execute_shell_command_time_out(self):
start_time = time() start_time = time()
output, rc = execute_shell_command_get_return_code('echo \'test 123\' && for i in {1..10}; do sleep 1; done', timeout=1) output, rc = execute_shell_command_get_return_code('echo \'test 123\' && for i in {1..10}; do sleep 1; done', timeout=1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment