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

Python tools.fail函数代码示例

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

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



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

示例1: get_peer_name

 def get_peer_name(name):
     if name.startswith(VETH0_PREFIX):
         return name.replace(VETH0_PREFIX, VETH1_PREFIX)
     elif name.startswith(VETH1_PREFIX):
         return name.replace(VETH1_PREFIX, VETH0_PREFIX)
     else:
         tools.fail("%s is not a valid VethFixture veth endpoint" % name)
开发者ID:EnterSrl,项目名称:neutron,代码行数:7,代码来源:net_helpers.py


示例2: assert_no_ping

 def assert_no_ping(self, dst_ip):
     try:
         self._ping_destination(dst_ip)
         tools.fail("destination ip %(dst_ip)s is replying to ping"
                    "from namespace %(ns)s, but it shouldn't" %
                    {'ns': self.namespace.namespace, 'dst_ip': dst_ip})
     except RuntimeError:
         pass
开发者ID:bradleyjones,项目名称:neutron,代码行数:8,代码来源:helpers.py


示例3: get

 def get(cls, bridge, namespace=None):
     """Deduce PortFixture class from bridge type and instantiate it."""
     if isinstance(bridge, ovs_lib.OVSBridge):
         return OVSPortFixture(bridge, namespace)
     if isinstance(bridge, bridge_lib.BridgeDevice):
         return LinuxBridgePortFixture(bridge, namespace)
     if isinstance(bridge, VethBridge):
         return VethPortFixture(bridge, namespace)
     tools.fail("Unexpected bridge type: %s" % type(bridge))
开发者ID:EnterSrl,项目名称:neutron,代码行数:9,代码来源:net_helpers.py


示例4: assert_no_arping

def assert_no_arping(src_namespace, dst_ip, source=None, timeout=1, count=1):
    try:
        assert_arping(src_namespace, dst_ip, source, timeout, count)
    except RuntimeError:
        pass
    else:
        tools.fail("destination ip %(destination)s is replying to arp from "
                   "namespace %(ns)s, but it shouldn't" %
                   {'ns': src_namespace, 'destination': dst_ip})
开发者ID:21atlas,项目名称:neutron,代码行数:9,代码来源:net_helpers.py


示例5: wrapper

 def wrapper(*args, **kwargs):
     try:
         return wrapped(*args, **kwargs)
     except (testtools.TestCase.skipException, unittest.case.SkipTest) as e:
         if base.bool_from_env('OS_FAIL_ON_MISSING_DEPS'):
             tools.fail(
                 '%s cannot be skipped because OS_FAIL_ON_MISSING_DEPS '
                 'is enabled, skip reason: %s' % (wrapped.__name__, e))
         raise
开发者ID:bgxavier,项目名称:neutron,代码行数:9,代码来源:base.py


示例6: assert_no_ping

def assert_no_ping(src_namespace, dst_ip, timeout=1, count=1):
    try:
        assert_ping(src_namespace, dst_ip, timeout, count)
    except RuntimeError:
        pass
    else:
        tools.fail(
            "destination ip %(destination)s is replying to ping from "
            "namespace %(ns)s, but it shouldn't" % {"ns": src_namespace, "destination": dst_ip}
        )
开发者ID:EnterSrl,项目名称:neutron,代码行数:10,代码来源:net_helpers.py


示例7: get

 def get(cls, bridge, namespace=None, mac=None, port_id=None,
         hybrid_plug=False):
     """Deduce PortFixture class from bridge type and instantiate it."""
     if isinstance(bridge, ovs_lib.OVSBridge):
         return OVSPortFixture(bridge, namespace, mac, port_id, hybrid_plug)
     if isinstance(bridge, bridge_lib.BridgeDevice):
         return LinuxBridgePortFixture(bridge, namespace, mac, port_id)
     if isinstance(bridge, VethBridge):
         return VethPortFixture(bridge, namespace)
     tools.fail('Unexpected bridge type: %s' % type(bridge))
开发者ID:muraliran,项目名称:neutron,代码行数:10,代码来源:net_helpers.py


示例8: _setUp

    def _setUp(self):
        # NOTE(cbrandily): Ensure we will not delete a directory existing
        # before test run during cleanup.
        if os.path.exists(self.directory):
            tools.fail('%s already exists' % self.directory)

        create_cmd = ['mkdir', '-p', self.directory]
        delete_cmd = ['rm', '-r', self.directory]
        utils.execute(create_cmd, run_as_root=True)
        self.addCleanup(utils.execute, delete_cmd, run_as_root=True)
开发者ID:21atlas,项目名称:neutron,代码行数:10,代码来源:helpers.py


示例9: test_arp_spoof_blocks_request

 def test_arp_spoof_blocks_request(self):
     # this will prevent the source from sending an ARP
     # request with its own address
     self._setup_arp_spoof_for_port(self.src_p.name, ["192.168.0.3"])
     self.src_p.addr.add("%s/24" % self.src_addr)
     self.dst_p.addr.add("%s/24" % self.dst_addr)
     ns_ip_wrapper = ip_lib.IPWrapper(self.src_namespace)
     try:
         ns_ip_wrapper.netns.execute(["arping", "-I", self.src_p.name, "-c1", self.dst_addr])
         tools.fail("arping should have failed. The arp request should " "have been blocked.")
     except RuntimeError:
         pass
开发者ID:neoareslinux,项目名称:neutron,代码行数:12,代码来源:test_ovs_flows.py


示例10: increment_ip_cidr

def increment_ip_cidr(ip_cidr, offset=1):
    """Increment ip_cidr offset times.

    example: increment_ip_cidr("1.2.3.4/24", 2) ==> "1.2.3.6/24"
    """
    net0 = netaddr.IPNetwork(ip_cidr)
    net = netaddr.IPNetwork(ip_cidr)
    net.value += offset
    if not net0.network < net.ip < net0.broadcast:
        tools.fail(
            'Incorrect ip_cidr,offset tuple (%s,%s): "incremented" ip_cidr is ' "outside ip_cidr" % (ip_cidr, offset)
        )
    return str(net)
开发者ID:EnterSrl,项目名称:neutron,代码行数:13,代码来源:net_helpers.py


示例11: set_namespace_gateway

def set_namespace_gateway(port_dev, gateway_ip):
    """Set gateway for the namespace associated to the port."""
    if not port_dev.namespace:
        tools.fail("tests should not change test machine gateway")
    port_dev.route.add_gateway(gateway_ip)
开发者ID:EnterSrl,项目名称:neutron,代码行数:5,代码来源:net_helpers.py


示例12: allocate_port

 def allocate_port(self):
     try:
         return self.unallocated_ports.pop()
     except KeyError:
         tools.fail("All FakeBridge ports (%s) are already allocated." % len(self.ports))
开发者ID:EnterSrl,项目名称:neutron,代码行数:5,代码来源:net_helpers.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python tools.setup_mock_calls函数代码示例发布时间:2022-05-27
下一篇:
Python test.is_extension_enabled函数代码示例发布时间: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