1#!/usr/bin/env python2 2"""Unittest for command_executer.py.""" 3 4from __future__ import print_function 5 6import time 7import unittest 8 9import command_executer 10 11 12class CommandExecuterTest(unittest.TestCase): 13 """Test for CommandExecuter class.""" 14 15 def testTimeout(self): 16 timeout = 1 17 logging_level = 'average' 18 ce = command_executer.CommandExecuter(logging_level) 19 start = time.time() 20 command = 'sleep 20' 21 ce.RunCommand(command, command_timeout=timeout, terminated_timeout=timeout) 22 end = time.time() 23 self.assertTrue(round(end - start) == timeout) 24 25 26if __name__ == '__main__': 27 unittest.main() 28