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


Python testtools.TestCase类代码示例

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


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


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