• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python testutils.run_cmd函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中testutils.run_cmd函数的典型用法代码示例。如果您正苦于以下问题:Python run_cmd函数的具体用法?Python run_cmd怎么用?Python run_cmd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了run_cmd函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_schedctl_combo_1

def test_schedctl_combo_1():
    """
    schedctl test run: combo_1

        Command Output:
        
        Command Error/Debug:Option combinations not allowed with: start option(s)
        
        
    """

    args      = """--start --stop"""
    exp_rs    = 256

    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('schedctl.py',_args,None) 
    rs      = results[0]
    cmd_out = results[1]
    cmd_err = results[3]

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
        "Command Error:\n%s\n\n" \
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)

    assert result, errmsg
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:35,代码来源:schedctl_sanity_test.py


示例2: test_releaseres_version

def test_releaseres_version():
    """
    releaseres test run: version

    """

    args      = """--version"""

    cmdout    = \
"""version: "releaseres.py " + $Id: releaseres.py 2146 2011-04-29 16:19:22Z richp $ + , Cobalt  + $Version$
"""

    cmderr    = ''

    stubout   = ''

    stubout_file = "stub.out"

    expected_results = ( 
                       0, # Expected return status 
                       cmdout, # Expected command output
                       stubout, # Expected stub functions output
                       cmderr, # Expected command error output 
                       ) 

    testutils.save_testhook("")

    results = testutils.run_cmd('releaseres.py',args,stubout_file) 
    result  = testutils.validate_results(results,expected_results)

    testutils.remove_testhook()

    correct = 1
    assert result == correct, "Result:\n%s" % result
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:34,代码来源:releaseres_test.py


示例3: test_qdel_jobid_1

def test_qdel_jobid_1():
    """
    qdel test run: jobid_1

        Command Output:
        
        Command Error/Debug:jobid must be an integer: myq
        
        
    """

    args      = """myq 1 2 3 4"""
    exp_rs    = 256

    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('qdel.py',_args,None) 
    rs      = results[0]
    cmd_out = results[1]
    cmd_err = results[3]

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
        "Command Error:\n%s\n\n" \
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)

    assert result, errmsg
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:35,代码来源:qdel_sanity_test.py


示例4: test_partlist_argument_1

def test_partlist_argument_1():
    """
    partlist test run: argument_1

    """

    args      = """arg"""

    cmdout    = ''

    cmderr    = \
"""No arguments required
"""

    stubout   = ''

    stubout_file = "stub.out"

    expected_results = ( 
                       256, # Expected return status 
                       cmdout, # Expected command output
                       stubout, # Expected stub functions output
                       cmderr, # Expected command error output 
                       ) 

    testutils.save_testhook("")

    results = testutils.run_cmd('partlist.py',args,stubout_file) 
    result  = testutils.validate_results(results,expected_results)

    testutils.remove_testhook()

    correct = 1
    assert result == correct, "Result:\n%s" % result
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:34,代码来源:partlist_test.py


示例5: test_qmove_queue_1

def test_qmove_queue_1():
    """
    qmove test run: queue_1

        Command Output:
        
        Command Error/Debug:Failed to match any jobs or queues
        
        
    """

    args      = """myq 1 2 3"""
    exp_rs    = 0

    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('qmove.py',_args,None) 
    rs      = results[0]
    cmd_out = results[1]
    cmd_err = results[3]

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
        "Command Error:\n%s\n\n" \
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)

    assert result, errmsg
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:35,代码来源:qmove_sanity_test.py


示例6: test_qsub_invalid_geometry_6

def test_qsub_invalid_geometry_6():
    """
    qsub test run: invalid_geometry_6

        Command Output:
        23
        
        Command Error/Debug:
        
    """

    args      = """--mode script -t50 -n10 --geometry 128x64x32x4    /bin/ls"""
    exp_rs    = 0

    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('qsub.py',_args,None) 
    rs      = results[0]
    cmd_out = results[1]
    cmd_err = results[3]

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
        "Command Error:\n%s\n\n" \
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)

    assert result, errmsg
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:35,代码来源:qsub_sanity_test.py


示例7: test_qsub_cwd_option_5

def test_qsub_cwd_option_5():
    """
    qsub test run: cwd_option_5

        Command Output:
        32
        
        Command Error/Debug:
        
    """

    args      = """--cwd /tmp -t10 -n 10 -e p -o x /bin/ls"""
    exp_rs    = 0

    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('qsub.py',_args,None) 
    rs      = results[0]
    cmd_out = results[1]
    cmd_err = results[3]

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
        "Command Error:\n%s\n\n" \
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)

    assert result, errmsg
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:35,代码来源:qsub_sanity_test.py


示例8: test_get_bootable_blocks_version

def test_get_bootable_blocks_version():
    """
    get-bootable-blocks test run: version

    """

    args      = """--version"""

    cmdout    = \
"""version: "get-bootable-blocks.py " + TBD + , Cobalt  + TBD
"""

    cmderr    = ''

    stubout   = ''

    stubout_file = "stub.out"

    expected_results = ( 
                       0, # Expected return status 
                       cmdout, # Expected command output
                       stubout, # Expected stub functions output
                       cmderr, # Expected command error output 
                       ) 

    testutils.save_testhook("")

    results = testutils.run_cmd('get-bootable-blocks.py',args,stubout_file) 
    result  = testutils.validate_results(results,expected_results)

    testutils.remove_testhook()

    correct = 1
    assert result == correct, "Result:\n%s" % result
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:34,代码来源:get-bootable-blocks_test.py


示例9: test_setres_add_res_2

def test_setres_add_res_2():
    """
    setres test run: add_res_2

        Command Output:
        
        Command Error/Debug:Must supply a start time for the reservation with -s
        
        
    """

    args      = """-n resname -D ANL-R00-R01-2048 ANL-R00-1024 ANL-R01-1024"""
    exp_rs    = 256

    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('setres.py',_args,None) 
    rs      = results[0]
    cmd_out = results[1]
    cmd_err = results[3]

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
        "Command Error:\n%s\n\n" \
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)

    assert result, errmsg
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:35,代码来源:setres_sanity_test.py


示例10: test_showres_combo

def test_showres_combo():
    """
    showres test run: combo

    """

    args      = """-l -x"""

    cmdout    = ''

    cmderr    = \
"""Only use -l or -x not both
"""

    stubout   = ''

    stubout_file = "stub.out"

    expected_results = ( 
                       256, # Expected return status 
                       cmdout, # Expected command output
                       stubout, # Expected stub functions output
                       cmderr, # Expected command error output 
                       ) 

    testutils.save_testhook("")

    results = testutils.run_cmd('showres.py',args,stubout_file) 
    result  = testutils.validate_results(results,expected_results)

    testutils.remove_testhook()

    correct = 1
    assert result == correct, "Result:\n%s" % result
开发者ID:ido,项目名称:cobalt,代码行数:34,代码来源:showres_test.py


示例11: test_get_bootable_blocks_geometry_10

def test_get_bootable_blocks_geometry_10():
    """
    get-bootable-blocks test run: geometry_10

    """

    args      = """--geometry 90x90x90x90x11 arg"""

    cmdout    = ''

    cmderr    = \
"""Invalid Geometry. Geometry must be in the form of AxBxCxDxE
"""

    stubout   = ''

    stubout_file = "stub.out"

    expected_results = ( 
                       256, # Expected return status 
                       cmdout, # Expected command output
                       stubout, # Expected stub functions output
                       cmderr, # Expected command error output 
                       ) 

    testutils.save_testhook("")

    results = testutils.run_cmd('get-bootable-blocks.py',args,stubout_file) 
    result  = testutils.validate_results(results,expected_results)

    testutils.remove_testhook()

    correct = 1
    assert result == correct, "Result:\n%s" % result
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:34,代码来源:get-bootable-blocks_test.py


示例12: test_schedctl_combo_1

def test_schedctl_combo_1():
    """
    schedctl test run: combo_1

    """

    args      = """--start --stop"""

    cmdout    = ''

    cmderr    = \
"""Option combinations not allowed with: start option(s)
"""

    stubout   = ''

    stubout_file = "stub.out"

    expected_results = ( 
                       256, # Expected return status 
                       cmdout, # Expected command output
                       stubout, # Expected stub functions output
                       cmderr, # Expected command error output 
                       ) 

    testutils.save_testhook("")

    results = testutils.run_cmd('schedctl.py',args,stubout_file) 
    result  = testutils.validate_results(results,expected_results)

    testutils.remove_testhook()

    correct = 1
    assert result == correct, "Result:\n%s" % result
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:34,代码来源:schedctl_test.py


示例13: test_schedctl_save_2

def test_schedctl_save_2():
    """
    schedctl test run: save_2

    """

    args      = """--savestate s"""

    cmdout    = ''

    cmderr    = \
"""directory s does not exist
"""

    stubout   = ''

    stubout_file = "stub.out"

    expected_results = ( 
                       256, # Expected return status 
                       cmdout, # Expected command output
                       stubout, # Expected stub functions output
                       cmderr, # Expected command error output 
                       ) 

    testutils.save_testhook("")

    results = testutils.run_cmd('schedctl.py',args,stubout_file) 
    result  = testutils.validate_results(results,expected_results)

    testutils.remove_testhook()

    correct = 1
    assert result == correct, "Result:\n%s" % result
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:34,代码来源:schedctl_test.py


示例14: test_schedctl_inherit_3

def test_schedctl_inherit_3():
    """
    schedctl test run: inherit_3

        Command Output:
        no jobs matched
        
        Command Error/Debug:
        
    """

    args      = """--inherit 1.0 1 2 3"""
    exp_rs    = 0

    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('schedctl.py',_args,None) 
    rs      = results[0]
    cmd_out = results[1]
    cmd_err = results[3]

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
        "Command Error:\n%s\n\n" \
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)

    assert result, errmsg
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:35,代码来源:schedctl_sanity_test.py


示例15: test_qsub_mode_option_4

def test_qsub_mode_option_4():
    """
    qsub test run: mode_option_4

        Command Output:
        
        Command Error/Debug:node count out of realistic range
        
        
    """

    args      = """-A Acceptance -q testing -n 49152 -t 60 --mode script /bin/ls"""
    exp_rs    = 256

    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('qsub.py',_args,None) 
    rs      = results[0]
    cmd_out = results[1]
    cmd_err = results[3]

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
        "Command Error:\n%s\n\n" \
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)

    assert result, errmsg
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:35,代码来源:qsub_sanity_test.py


示例16: test_setres_id_change_7

def test_setres_id_change_7():
    """
    setres test run: id_change_7

        Command Output:
        
        Command Error/Debug:No partition arguments or other options allowed with id change options
        
        
    """

    args      = """--cycle_id 8 -p ANL-R00-R01-2048"""
    exp_rs    = 256

    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('setres.py',_args,None) 
    rs      = results[0]
    cmd_out = results[1]
    cmd_err = results[3]

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
        "Command Error:\n%s\n\n" \
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)

    assert result, errmsg
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:35,代码来源:setres_sanity_test.py


示例17: test_qsub_script_3

def test_qsub_script_3():
    """
    qsub test run: script_3

        Command Output:
        
        Command Error/Debug:Mode already set to 'script' and trying to set it again to 'vn'
        
        
    """

    args      = """--mode vn cobalt_script1.sh"""
    exp_rs    = 256

    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('qsub.py',_args,None) 
    rs      = results[0]
    cmd_out = results[1]
    cmd_err = results[3]

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
        "Command Error:\n%s\n\n" \
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)

    assert result, errmsg
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:35,代码来源:qsub_sanity_test.py


示例18: test_setres_id_change_2

def test_setres_id_change_2():
    """
    setres test run: id_change_2

        Command Output:
        Setting cycle_id to 8
        
        Command Error/Debug:
        
    """

    args      = """--cycle_id 8"""
    exp_rs    = 0

    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('setres.py',_args,None) 
    rs      = results[0]
    cmd_out = results[1]
    cmd_err = results[3]

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
        "Command Error:\n%s\n\n" \
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)

    assert result, errmsg
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:35,代码来源:setres_sanity_test.py


示例19: test_qsub_no_roject_specified

def test_qsub_no_roject_specified():
    """
    qsub test run: no_roject_specified

        Command Output:
        
        Command Error/Debug:'time' not provided
        
        
    """

    args      = """-A -t50 -n10 /bin/ls"""
    exp_rs    = 256

    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('qsub.py',_args,None) 
    rs      = results[0]
    cmd_out = results[1]
    cmd_err = results[3]

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
        "Command Error:\n%s\n\n" \
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)

    assert result, errmsg
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:35,代码来源:qsub_sanity_test.py


示例20: test_setres_force_4

def test_setres_force_4():
    """
    setres test run: force_4

        Command Output:
        
        Command Error/Debug:--force_id can only be used with --cycle_id and/or --res_id.
        
        
    """

    args      = """--force_id -m -n resname"""
    exp_rs    = 256

    user    = pwd.getpwuid(os.getuid())[0] 
    _args   = args.replace('<USER>',user)

    results = testutils.run_cmd('setres.py',_args,None) 
    rs      = results[0]
    cmd_out = results[1]
    cmd_err = results[3]

    # Test Pass Criterias
    no_rs_err     = (rs == exp_rs)
    no_fatal_exc  = (cmd_out.find("FATAL EXCEPTION") == -1)

    result = no_rs_err and no_fatal_exc

    errmsg  = "\n\nFailed Data:\n\n" \
        "Return Status %s, Expected Return Status %s\n\n" \
        "Command Output:\n%s\n\n" \
        "Command Error:\n%s\n\n" \
        "Arguments: %s" % (str(rs), str(exp_rs), str(cmd_out), str(cmd_err), _args)

    assert result, errmsg
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:35,代码来源:setres_sanity_test.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python testutils.save_testhook函数代码示例发布时间:2022-05-27
下一篇:
Python testutils.remove_testhook函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap