当前位置: 首页>>代码示例>>Python>>正文


Python CommandHelper.setLogPriority方法代码示例

本文整理汇总了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!")
开发者ID:CSD-Public,项目名称:stonix,代码行数:49,代码来源:zzzTestFrameworkCommandHelper.py

示例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!")
开发者ID:inscriptionweb,项目名称:stonix,代码行数:48,代码来源:zzzTestFrameworkCommandHelper.py


注:本文中的src.stonix_resources.CommandHelper.CommandHelper.setLogPriority方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。