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

Python nose.main函数代码示例

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

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



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

示例1: main

def main():
    """Run tests when called directly"""
    import nose
    print("-----------------")
    print("Running the tests")
    print("-----------------")
    nose.main()
开发者ID:hgamboa,项目名称:novainstrumentation,代码行数:7,代码来源:wfdbtools.py


示例2: main

def main():
  sys.path = extra_paths + sys.path
  os.environ['SERVER_SOFTWARE'] = 'Development via nose'
  os.environ['SERVER_NAME'] = 'Foo'
  os.environ['SERVER_PORT'] = '8080'
  os.environ['APPLICATION_ID'] = 'test-app-run'
  os.environ['USER_EMAIL'] = '[email protected]'
  os.environ['CURRENT_VERSION_ID'] = 'testing-version'
  import main as app_main
  from google.appengine.api import apiproxy_stub_map
  from google.appengine.api import datastore_file_stub
  from google.appengine.api import mail_stub
  from google.appengine.api import user_service_stub
  from google.appengine.api import urlfetch_stub
  from google.appengine.api.memcache import memcache_stub
  apiproxy_stub_map.apiproxy = apiproxy_stub_map.APIProxyStubMap()
  apiproxy_stub_map.apiproxy.RegisterStub('urlfetch',
                                          urlfetch_stub.URLFetchServiceStub())
  apiproxy_stub_map.apiproxy.RegisterStub('user',
                                          user_service_stub.UserServiceStub())
  apiproxy_stub_map.apiproxy.RegisterStub('datastore',
    datastore_file_stub.DatastoreFileStub('test-app-run', None, None))
  apiproxy_stub_map.apiproxy.RegisterStub('memcache',
    memcache_stub.MemcacheServiceStub())
  apiproxy_stub_map.apiproxy.RegisterStub('mail', mail_stub.MailServiceStub())
  import django.test.utils
  django.test.utils.setup_test_environment()
  
  from nose.plugins import cover
  plugin = cover.Coverage()
  nose.main(plugins=[AppEngineDatastoreClearPlugin(), plugin])
开发者ID:jamslevy,项目名称:gsoc,代码行数:31,代码来源:run.py


示例3: main

def main():
    #logging.basicConfig(level=logging.DEBUG)
    sys.path.insert(0, SDK_PATH)
    sys.path.insert(0, "stashboard")
    import dev_appserver
    dev_appserver.fix_sys_path()
    nose.main()
开发者ID:Open-Source-GIS,项目名称:stashboard,代码行数:7,代码来源:runner.py


示例4: main

def main(operation=None):
    if operation == 'run':
        logger.info('Running the application.')
        cherrypy.config.update({
            'tools.staticdir.root': settings.PROJECT_ROOT,
            'error_page.404': app.error_404
        })
        cherrypy.quickstart(app.FlyingFist(), config='config.conf')
    elif operation == 'create_storage':
        logger.info('Creating the RDF storage.')
        st = storage.StorageCreator()
        st.create()
        st.save(settings.ONTOLOGY_FILE, settings.INSTANCES_FILE)
    elif operation == 'create_index':
        logger.info('Creating the Lucene index.')
        ic = storage.IndexCreator()
        ic.create_index()
    elif operation == 'test':
        logger.info('Running tests.')
        import nose
        nose.main(argv=['-w', 'tests'])
    else:
        sys.stderr.write('Unknown argument: %s\r\n' % operation)
        print __doc__
        return 2
    return 0
开发者ID:kpuputti,项目名称:webtech,代码行数:26,代码来源:fist.py


示例5: run

    def run(self):
        test.run(self)

        import nose
        import logging
        logging.disable(logging.CRITICAL)
        nose.main(argv=['tests', '-v'])
开发者ID:damirazo,项目名称:frontik,代码行数:7,代码来源:setup.py


示例6: main

def main():
    """run nose tests on "<package-name>" where <package-name is ".." dir"""

    path = os.path.abspath(os.path.join('..'))

    package_name = os.path.basename(path)

    try:
        my_module = importlib.import_module(package_name)
    except ImportError:
        raise ImportError('Cound not import {} so cannot '
                          'run nose tests'.format(package_name))

    # need to change the working directory to the installed package
    # otherwise nose will just find <package-name> based on the current
    # directory
    cwd = os.getcwd()
    package_path = os.path.dirname(my_module.__file__)
    os.chdir(package_path)


    print('nose tests on "{}" package.'.format(package_name))
    #'nose ignores 1st argument http://stackoverflow.com/a/7070571/2530083'
    nose.main(argv=['nose_ignores_1st_arg',
                    package_name,
                    '-v',
                    '--with-doctest',
                    '--doctest-options=+ELLIPSIS',
                    '--doctest-options=+IGNORE_EXCEPTION_DETAIL'])

    os.chdir(cwd)
开发者ID:open-geotechnical,项目名称:geotecha,代码行数:31,代码来源:_tests_with_nose.py


示例7: start

def start(argv=None, modules=None, nose_options=None, description=None,
          version=None, plugins=None):
    '''Start djpcms tests. Use this function to start tests for
djpcms aor djpcms applications. It check for pulsar and nose
and add testing plugins.'''
    use_nose = False
    argv = argv or sys.argv
    description = description or 'Djpcms Asynchronous test suite'
    version = version or djpcms.__version__
    if len(argv) > 1 and argv[1] == 'nose':
        use_nose = True
        sys.argv.pop(1)
    if use_nose:
        os.environ['djpcms_test_suite'] = 'nose'
        if stdnet_test and plugins is None:
            plugins = [stdnet_test.NoseStdnetServer()]
        argv = list(argv)
        if nose_options:
            nose_options(argv)
        nose.main(argv=argv, addplugins=plugins)
    else:
        os.environ['djpcms_test_suite'] = 'pulsar'
        from pulsar.apps.test import TestSuite
        from pulsar.apps.test.plugins import bench, profile
        if stdnet_test and plugins is None:
            plugins = (stdnet_test.PulsarStdnetServer(),
                       bench.BenchMark(),
                       profile.Profile())
        suite = TestSuite(modules=modules,
                          plugins=plugins,
                          description=description,
                          version=version)
        suite.start()
开发者ID:pombredanne,项目名称:djpcms,代码行数:33,代码来源:test.py


示例8: test

def test(nose_arguments):
    """Run nosetests with the given arguments and report coverage"""
    assert nose_arguments[0] == ""
    import nose
    from nose.plugins.cover import Coverage

    nose.main(argv=nose_arguments, addplugins=[Coverage()])
开发者ID:craigmichaelmartin,项目名称:flask-truss,代码行数:7,代码来源:manage.py


示例9: main

def main():
    #logcat()
    def is_plugin(c):
        try: return issubclass(c,nose.plugins.Plugin)
        except TypeError: return False

    plugins = [ ]

    def listdir(dir):
        try: return os.listdir(dir)
        except OSError: return []

    for p in [    os.path.join(PLUGINS_DIRECTORY,_)
                for _ in listdir(PLUGINS_DIRECTORY) if _.endswith('.py') ]:
        print ('Loading plugin %s' % p)

        l={}
        c=open(p,'rt').read()    # Windows or Unix line endings
        if hasattr(c,'decode'):
            c=c.decode('utf-8') # Python 2.x
        _exec(compile(c, p, 'exec'), globals(), l)

        plugins += [ c() for c in l.values() if is_plugin(c) ]

    plugins = [ c() for c in globals().values() if is_plugin(c) ] + plugins

    nose.main(argv=sys.argv + ['-s','-d'], config=nose.config.Config(
            plugins=nose.plugins.manager.DefaultPluginManager(plugins=plugins)))
开发者ID:JerryLiu0821,项目名称:apython,代码行数:28,代码来源:runtests.py


示例10: main

def main():
    # First of all add current work directory to ``sys.path`` if it not there
    cwd = os.getcwd()

    if not cwd in sys.path or not cwd.strip(os.sep) in sys.path:
        sys.path.append(cwd)

    # Try to find that DjangoPlugin loaded from entry_points or not
    found, kwargs = False, {}

    manager = EntryPointPluginManager()
    manager.loadPlugins()

    for plugin in manager.plugins:
        if isinstance(plugin, DjangoPlugin):
            found = True
            break

    # If not manually add
    if not found:
        kwargs = {'addplugins': [DjangoPlugin()]}

    # Enable DjangoPlugin
    os.environ['NOSE_WITH_DJANGO'] = '1'

    # Run ``nosetests``
    nose.main(**kwargs)
开发者ID:bloodpet,项目名称:tddspry,代码行数:27,代码来源:django-nosetests.py


示例11: test

def test():
    r"""
    Run all the doctests available.
    """
    path = os.path.split(__file__)[0]
    print("Path: "+path)
    nose.main(argv=['-w', path, '--with-doctest'])
开发者ID:usnistgov,项目名称:dft-crossfilter,代码行数:7,代码来源:__init__.py


示例12: run_tests

    def run_tests(self):
        try:
            import matplotlib
            matplotlib.use('agg')
            import nose
            from matplotlib.testing.noseclasses import KnownFailure
            from matplotlib import default_test_modules
            from matplotlib import font_manager
            import time
            # Make sure the font caches are created before starting any possibly
            # parallel tests
            if font_manager._fmcache is not None:
                while not os.path.exists(font_manager._fmcache):
                    time.sleep(0.5)
            plugins = [KnownFailure]

            # Nose doesn't automatically instantiate all of the plugins in the
            # child processes, so we have to provide the multiprocess plugin
            # with a list.
            from nose.plugins import multiprocess
            multiprocess._instantiate_plugins = plugins

            if '--no-pep8' in sys.argv:
                default_test_modules.remove('matplotlib.tests.test_coding_standards')
                sys.argv.remove('--no-pep8')
            elif '--pep8' in sys.argv:
                default_test_modules = ['matplotlib.tests.test_coding_standards']
                sys.argv.remove('--pep8')
            nose.main(addplugins=[x() for x in plugins],
                      defaultTest=default_test_modules,
                      argv=['nosetests'],
                      exit=False)
        except ImportError:
            sys.exit(-1)
开发者ID:HolgerPeters,项目名称:matplotlib,代码行数:34,代码来源:setup.py


示例13: do_test

def do_test():
    do_uic()
    do_rcc()
    call(py_script('flake8'), 'mozregui', 'build.py', 'tests')
    print('Running tests...')
    import nose
    nose.main(argv=['-s', 'tests'])
开发者ID:askeing,项目名称:mozregression,代码行数:7,代码来源:build.py


示例14: start

def start():
    global pulsar
    argv = sys.argv
    if len(argv) > 1 and argv[1] == 'nose':
        pulsar = None
        sys.argv.pop(1)
    
    if pulsar:
        from pulsar.apps.test import TestSuite
        from pulsar.apps.test.plugins import bench, profile
        
        os.environ['stdnet_test_suite'] = 'pulsar'
        suite = TestSuite(
                description='Dynts Asynchronous test suite',
                    plugins=(profile.Profile(),
                             bench.BenchMark(),)
                  )
        suite.start()
    elif nose:
        os.environ['stdnet_test_suite'] = 'nose'
        argv = list(sys.argv)
        noseoption(argv, '-w', value = 'tests/regression')
        noseoption(argv, '--all-modules')
        nose.main(argv=argv, addplugins=[NoseHttpProxy()])
    else:
        print('To run tests you need either pulsar or nose.')
        exit(0)
开发者ID:OspreyX,项目名称:dynts,代码行数:27,代码来源:runtests.py


示例15: runtests

def runtests():
    import nose
    argv = []
    argv.insert(1, '')
    argv.insert(2, '--with-coverage')
    argv.insert(3, '--cover-package=facio')
    nose.main(argv=argv)
开发者ID:jackqu7,项目名称:Facio,代码行数:7,代码来源:runtests.py


示例16: nose_test

def nose_test(module=None, extraArgs=None, pymelDir=None):
    """
    Run pymel unittests / doctests
    """
    if pymelDir:
        os.chdir(pymelDir)
            
    os.environ['MAYA_PSEUDOTRANS_MODE']='5'
    os.environ['MAYA_PSEUDOTRANS_VALUE']=','
    
    noseKwArgs={}
    noseArgv = "dummyArg0 --with-doctest -vv".split()
    if module is None:
        #module = 'pymel' # if you don't set a module, nose will search the cwd
                    
        exclusion = '^windows ^tools ^example1 ^testingutils ^pmcmds ^testPa ^maya ^maintenance ^pymel_test ^TestPymel ^testPassContribution$'
        noseArgv += ['--exclude', '|'.join( [ '(%s)' % x for x in exclusion.split() ] )  ]
           
    if inspect.ismodule(module):
        noseKwArgs['module']=module
    elif module:
        noseArgv.append(module)
    if extraArgs is not None:
        noseArgv.extend(extraArgs)
    noseKwArgs['argv'] = noseArgv
    
    patcher = DocTestPatcher()
    try:
        print noseKwArgs
        nose.main( **noseKwArgs)
    finally:
        patcher.reset()
开发者ID:adamcobabe,项目名称:pymel,代码行数:32,代码来源:pymel_test.py


示例17: main

def main():
    env = os.environ.copy()
    if "NOSE_IGNORE_FILES" not in env:
        env["NOSE_IGNORE_FILES"] = ignorefiles
    if "NOSE_WITH_DOCTEST" not in env:
        env["NOSE_WITH_DOCTEST"] = "t"
    nose.main(env=env, addplugins=[nosecaptureexc.CaptureExcPlugin(), nosehgenv.HgEnvPlugin()])
开发者ID:velorientc,项目名称:git_test7,代码行数:7,代码来源:run-tests.py


示例18: run

    def run(self, project, args, unknown_args):
        try:
            import nose

            argv = ["discover"]

            print("Running tests for:")

            if args.include_forecast:
                print("   forecast")
                argv.append("forecast")

            for application in project.applications.keys():
                if application.startswith("forecast."):
                    continue

                argv.append(application)
                print("   %s" % (application,))

            print()

            argv.extend(unknown_args)
            nose.main(argv=argv)

        except ImportError:
            raise ForecastError("nosetests required for test running.")
开发者ID:netcriptus,项目名称:forecast,代码行数:26,代码来源:test.py


示例19: main

def main():
    """Runs the testsuite as command line application."""
    import nose
    try:
        nose.main(defaultTest="")
    except Exception, e:
        print 'Error: %s' % e
开发者ID:meric,项目名称:jsjinja,代码行数:7,代码来源:test_templates.py


示例20: run_tests

    def run_tests(self):
        import matplotlib
        matplotlib.use('agg')
        import nose
        from matplotlib.testing.noseclasses import KnownFailure
        from matplotlib import default_test_modules as testmodules
        from matplotlib import font_manager
        import time
        # Make sure the font caches are created before starting any possibly
        # parallel tests
        if font_manager._fmcache is not None:
            while not os.path.exists(font_manager._fmcache):
                time.sleep(0.5)
        plugins = [KnownFailure]

        # Nose doesn't automatically instantiate all of the plugins in the
        # child processes, so we have to provide the multiprocess plugin
        # with a list.
        from nose.plugins import multiprocess
        multiprocess._instantiate_plugins = plugins

        if self.omit_pep8:
            testmodules.remove('matplotlib.tests.test_coding_standards')
        elif self.pep8_only:
            testmodules = ['matplotlib.tests.test_coding_standards']

        nose.main(addplugins=[x() for x in plugins],
                  defaultTest=testmodules,
                  argv=['nosetests'] + self.test_args,
                  exit=True)
开发者ID:Acanthostega,项目名称:matplotlib,代码行数:30,代码来源:setup.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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