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


Python nose.main函数代码示例

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


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


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