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

Python testtools.TestCase类代码示例

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

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



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

示例1: setUp

 def setUp(self):
     self.builder = jenkins_jobs.builder.Builder(
         'http://jenkins.example.com',
         'doesnot', 'matter',
         plugins_list=['plugin1', 'plugin2'],
     )
     TestCase.setUp(self)
开发者ID:nwolfe,项目名称:jenkins-job-builder,代码行数:7,代码来源:test_builder.py


示例2: setUp

 def setUp(self):
     TestCase.setUp(self)
     out = StringIO()
     out.writelines(["Q1,373,string,Universe\n",
                     "Q1,31,wikibase-entityid,Q223557\n",
                     "Q1,31,wikibase-entityid,Q1088088\n"])
     out.seek(0)
     self.result = list(CsvReader.read_csv(out))
开发者ID:Dacry,项目名称:EditItemSuggestions,代码行数:8,代码来源:test_csv_reader.py


示例3: wait_no_exception

def wait_no_exception(lfunction, exc_class=None, exc_matcher=None):
    """Stops waiting on success."""
    start_time = time.time()
    if exc_matcher is not None:
        exc_class = boto.exception.BotoServerError

    if exc_class is None:
        exc_class = BaseException
    while True:
        result = None
        try:
            result = lfunction()
            LOG.info('No Exception in %d second',
                     time.time() - start_time)
            return result
        except exc_class as exc:
            if exc_matcher is not None:
                res = exc_matcher.match(exc)
                if res is not None:
                    LOG.info(res)
                    raise exc
        # Let the other exceptions propagate
        dtime = time.time() - start_time
        if dtime > CONF.boto.build_timeout:
            raise TestCase.failureException("Wait timeout exceeded! (%ds)" %
                                            dtime)
        time.sleep(CONF.boto.build_interval)
开发者ID:Grindizer,项目名称:tempest,代码行数:27,代码来源:wait.py


示例4: state_wait

def state_wait(lfunction, final_set=set(), valid_set=None):
    # TODO(afazekas): evaluate using ABC here
    if not isinstance(final_set, set):
        final_set = set((final_set,))
    if not isinstance(valid_set, set) and valid_set is not None:
        valid_set = set((valid_set,))
    start_time = time.time()
    old_status = status = lfunction()
    while True:
        if status != old_status:
            LOG.info('State transition "%s" ==> "%s" %d second', old_status,
                     status, time.time() - start_time)
        if status in final_set:
            return status
        if valid_set is not None and status not in valid_set:
            return status
        dtime = time.time() - start_time
        if dtime > CONF.boto.build_timeout:
            raise TestCase.failureException("State change timeout exceeded!"
                                            '(%ds) While waiting'
                                            'for %s at "%s"' %
                                            (dtime, final_set, status))
        time.sleep(CONF.boto.build_interval)
        old_status = status
        status = lfunction()
开发者ID:Grindizer,项目名称:tempest,代码行数:25,代码来源:wait.py


示例5: wait_exception

def wait_exception(lfunction):
    """Returns with the exception or raises one."""
    start_time = time.time()
    while True:
        try:
            lfunction()
        except BaseException as exc:
            LOG.info('Exception in %d second',
                     time.time() - start_time)
            return exc
        dtime = time.time() - start_time
        if dtime > CONF.boto.build_timeout:
            raise TestCase.failureException("Wait timeout exceeded! (%ds)" %
                                            dtime)
        time.sleep(CONF.boto.build_interval)
开发者ID:Grindizer,项目名称:tempest,代码行数:15,代码来源:wait.py


示例6: re_search_wait

def re_search_wait(lfunction, regexp):
    """Stops waiting on success."""
    start_time = time.time()
    while True:
        text = lfunction()
        result = re.search(regexp, text)
        if result is not None:
            LOG.info('Pattern "%s" found in %d second in "%s"',
                     regexp,
                     time.time() - start_time,
                     text)
            return result
        dtime = time.time() - start_time
        if dtime > CONF.boto.build_timeout:
            raise TestCase.failureException('Pattern find timeout exceeded!'
                                            '(%ds) While waiting for'
                                            '"%s" pattern in "%s"' %
                                            (dtime, regexp, text))
        time.sleep(CONF.boto.build_interval)
开发者ID:Grindizer,项目名称:tempest,代码行数:19,代码来源:wait.py


示例7: _skipper

 def _skipper(*args, **kw):
     """Wrapped skipper function."""
     testobj = args[0]
     if not getattr(testobj, self.attr, False):
         raise TestCase.skipException(self.message)
     func(*args, **kw)
开发者ID:SinSiXX,项目名称:tempest,代码行数:6,代码来源:utils.py


示例8: setUp

 def setUp(self):
     TestCase.setUp(self)
     with gzip.open(resource_filename(__name__, "Wikidata-Q1.xml.gz"), "r") as f:
         self.result = list(XmlReader.read_xml(f))
开发者ID:Dacry,项目名称:EditItemSuggestions,代码行数:4,代码来源:test_xml_reader.py


示例9: tearDown

 def tearDown(self):
     self._calls.append("tearDown")
     TestCase.tearDown(self)
开发者ID:kampka,项目名称:testtools,代码行数:3,代码来源:test_testcase.py


示例10: setUp

 def setUp(self):
     TestCase.setUp(self)
     raise self.skipException("skipping this test")
开发者ID:RolfAndreassen,项目名称:wiredtiger,代码行数:3,代码来源:test_testcase.py


示例11: setUp

 def setUp(self):
     TestCase.setUp(self)
     self.data = {"a": {"b": {"c": "d"}, "e": "f"}}
开发者ID:alex-n,项目名称:yconf,代码行数:3,代码来源:test_util.py


示例12: tearDown

 def tearDown(self):
     ResourcedTestCase.tearDown(self)
     TestCase.tearDown(self)
开发者ID:jkakar,项目名称:commandant,代码行数:3,代码来源:basic.py


示例13: setUp

 def setUp(self):
     TestCase.setUp(self)
     self.data = {"testcase": {"test-level": 1}}
开发者ID:kampka,项目名称:yconf,代码行数:3,代码来源:test_config.py


示例14: setUp

 def setUp(self):
     TestCase.setUp(self)
     result = testresources._get_result()
     testresources.setUpResources(self, self.resources, result)
     self.addCleanup(
         testresources.tearDownResources, self, self.resources, result)
开发者ID:rbtcollins,项目名称:lmirror,代码行数:6,代码来源:__init__.py


示例15: setUp

 def setUp(self):
     TestCase.setUp(self)
     self.result = [Entity("Q1", [Claim(373, "string", "Universe"),
                                  Claim(31, "wikibase-entityid", "Q223557"),
                                  Claim(31, "wikibase-entityid", "Q1088088")])]
开发者ID:Dacry,项目名称:EditItemSuggestions,代码行数:5,代码来源:test_abstract_reader.py


示例16: setUp

 def setUp(self):
     TestCase.setUp(self)
     ResourcedTestCase.setUp(self)
开发者ID:jkakar,项目名称:commandant,代码行数:3,代码来源:basic.py


示例17: __init__

 def __init__(self, *args, **kwargs):
     TestCase.__init__(self, *args, **kwargs)
     self._workdir = None
     self._environ_restore = None
开发者ID:satra,项目名称:testkraut,代码行数:4,代码来源:testcase.py


示例18: setUp

 def setUp(self):
     TestCase.setUp(self)
     self._calls = ["setUp"]
开发者ID:kampka,项目名称:testtools,代码行数:3,代码来源:test_testcase.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python assertions.assert_that函数代码示例发布时间:2022-05-27
下一篇:
Python testtools.RunTest类代码示例发布时间: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