本文整理汇总了Python中src.stonix_resources.CommandHelper.CommandHelper.setLogPriority方法的典型用法代码示例。如果您正苦于以下问题:Python CommandHelper.setLogPriority方法的具体用法?Python CommandHelper.setLogPriority怎么用?Python CommandHelper.setLogPriority使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类src.stonix_resources.CommandHelper.CommandHelper
的用法示例。
在下文中一共展示了CommandHelper.setLogPriority方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: zzzTestFrameworkCommandHelper
# 需要导入模块: from src.stonix_resources.CommandHelper import CommandHelper [as 别名]
# 或者: from src.stonix_resources.CommandHelper.CommandHelper import setLogPriority [as 别名]
class zzzTestFrameworkCommandHelper(unittest.TestCase):
'''
Perform tests on different parts of the functionality for framework CommandHelper
@param unittest.TestCase: unittest TestCase class inheritance object reference
@author: ekkehard
@change: Breen Malmberg - 04/11/2018 - removed assertion tests -
you can't test for exception assertions in code that is wrapped by try
except because the try except intercepts the exception and throws it
and it never gets back to the assertraises call (see tf ticket for documentation)
'''
def setUp(self):
'''
'''
self.enviro = Environment()
self.enviro.setdebugmode(True)
self.logger = LogDispatcher(self.enviro)
self.commandhelper = CommandHelper(self.logger)
def tearDown(self):
'''
'''
pass
def testExecuteValidCommand(self):
'''
'''
self.assertTrue(self.commandhelper.executeCommand("ls -l /"),
"Execute Valid Command string Failed!")
self.assertTrue(self.commandhelper.executeCommand(["ls", "-l", "/"]),
"Execute Valid Command List Failed!")
def testSetLogPriority(self):
'''
'''
self.assertTrue(self.commandhelper.setLogPriority(LogPriority.INFO),
"Execute setLogPriority(0) Command string Failed!")
self.assertTrue(self.commandhelper.executeCommand(["ls", "-l", "/"]),
"Execute commandhelper.executeCommand(['ls','-l','/'])"
+ " Command List Failed!")
示例2: zzzTestFrameworkCommandHelper
# 需要导入模块: from src.stonix_resources.CommandHelper import CommandHelper [as 别名]
# 或者: from src.stonix_resources.CommandHelper.CommandHelper import setLogPriority [as 别名]
class zzzTestFrameworkCommandHelper(unittest.TestCase):
def setUp(self):
self.enviro = Environment()
self.enviro.setdebugmode(True)
self.logger = LogDispatcher(self.enviro)
self.commandhelper = CommandHelper(self.logger)
def tearDown(self):
pass
def testBlankCommand(self):
self.assertRaises(ValueError, self.commandhelper.setCommand, "")
self.assertRaises(TypeError, self.commandhelper.executeCommand, None)
self.assertRaises(ValueError, self.commandhelper.executeCommand, "")
self.assertRaises(ValueError, self.commandhelper.setCommand, [])
self.assertRaises(TypeError, self.commandhelper.executeCommand, None)
self.assertRaises(ValueError, self.commandhelper.executeCommand, [])
def testExecuteValidCommand(self):
self.assertTrue(self.commandhelper.executeCommand("ls -l /"),
"Execute Valid Command string Failed!")
self.assertTrue(self.commandhelper.executeCommand(["ls", "-l", "/"]),
"Execute Valid Command List Failed!")
def testExecuteInvalidCommand(self):
self.assertRaises(TypeError, self.commandhelper.executeCommand, 0)
self.assertRaises(TypeError, self.commandhelper.executeCommand,
['ls', 0, '/'])
def testSetLogPriority(self):
self.assertRaises(TypeError, self.commandhelper.setLogPriority, 0)
self.assertTrue(self.commandhelper.setLogPriority(LogPriority.INFO),
"Execute setLogPriority(0) Command string Failed!")
self.assertTrue(self.commandhelper.executeCommand(["ls", "-l", "/"]),
"Execute commandhelper.executeCommand(['ls','-l','/'])"
+ " Command List Failed!")