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


Python unittest.unittest_main函数代码示例

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


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

示例1: main

def main():
    global _host, _port, _port2
    parser = OptionParser()
    parser.add_option("-d", "--debug", action="store_true", dest="debug", default=False,
                      help="logging level DEBUG")

    parser.add_option("--host", dest="host", default="localhost")
    parser.add_option("--port", dest="port", default=17890, type="int")
    parser.add_option("--port2", dest="port2", default=17891, type="int")

    opts, args = parser.parse_args()

    if opts.debug:
        logging.basicConfig(level=logging.DEBUG)
    logging.basicConfig(level=logging.INFO)

    _host = opts.host
    _port = opts.port
    _port2 = opts.port2

    unittest_main()
开发者ID:Biomine3000,项目名称:Objectoplex,代码行数:21,代码来源:tests.py

示例2: load_tests

# -*- coding: utf-8 -*-
############################################################################
#
# Copyright © 2015 OnlineGroups.net and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
############################################################################
from __future__ import absolute_import, unicode_literals
from unittest import TestSuite, main as unittest_main
from gs.profile.email.base.tests.emailaddress import TestCheckAddress

testCases = (TestCheckAddress, )


def load_tests(loader, tests, pattern):
    suite = TestSuite()
    for testClass in testCases:
        tests = loader.loadTestsFromTestCase(testClass)
        suite.addTests(tests)
    return suite

if __name__ == '__main__':
    unittest_main()
开发者ID:groupserver,项目名称:gs.profile.email.base,代码行数:30,代码来源:test_all.py

示例3: establish_connect

        self.ssh_client = establish_connect(self.master_ip, 'hduser', '',
                                   MASTER_SSH_PORT)
    def tearDown(self):
        self.ssh_client.close();
        os.system('rm ' + FILE_RUN_PI)

    def run_pi(self, pi_map, pi_sec):
        '''Runs a pi job'''
        #hduser_pass = get_hduser_pass()
        logging.log(REPORT, ' Running pi job')
        command = '/usr/local/hadoop/bin/hadoop jar' \
                  ' /usr/local/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-examples-*.jar pi ' + \
                  str(pi_map)+' '+str(pi_sec)
        exec_command(self.ssh_client, command)
        line = check_string(FILE_RUN_PI, "Estimated value of Pi is")
        return float(line[25:])


    def test_run_pi_2_10000(self):
        expected = 3.14280000000000000000;
        returned = self.run_pi(2, 10000);
        self.assertEqual(returned, expected);

    def test_run_pi_10_1000000(self):
        expected = 3.14158440000000000000;
        returned = self.run_pi(10, 1000000);
        self.assertEqual(returned, expected);

if __name__ == "__main__":
    unittest_main();
开发者ID:themiszamani,项目名称:e-science,代码行数:30,代码来源:test_run_pi.py


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