當前位置: 首頁>>代碼示例>>Python>>正文


Python runner.Runner類代碼示例

本文整理匯總了Python中behave.runner.Runner的典型用法代碼示例。如果您正苦於以下問題:Python Runner類的具體用法?Python Runner怎麽用?Python Runner使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Runner類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: run_tests

def run_tests(room, vendor, tags, override):

    def on_snapshot(snapshot, plan):
        event = {
            'snapshot': snapshot,
            'plan': plan,
        }
        socketio.emit('snapshot', event, room=room)

    try:
        output = io.StringIO()
        output_stream = StreamOpener(stream=output)
        config = Configuration(
            outputs=[output_stream],
            format=['json.chunked'],
            on_snapshot=on_snapshot,
            vendor=vendor,
            override=override,
            command_args=[],
            tags=[','.join(tags)],
        )
        runner = Runner(config)

        runner.run()
    except Exception as err:  # pylint: disable=broad-except
        socketio.emit('global_error', str(err))
    finally:
        socketio.emit('tests_complete', room=room)
開發者ID:Cphrampus,項目名稱:test-suite,代碼行數:28,代碼來源:tasks.py

示例2: test_simple_testcase_fails_when_accessing_base_url

 def test_simple_testcase_fails_when_accessing_base_url(self):
     runner = Runner(mock.MagicMock())
     runner.context = Context(runner)
     SimpleTestRunner().patch_context(runner.context)
     SimpleTestRunner().setup_testclass(runner.context)
     with pytest.raises(AssertionError):
         assert runner.context.base_url == 'should raise an exception!'
開發者ID:bittner,項目名稱:behave-django,代碼行數:7,代碼來源:test_simple_testcase.py

示例3: test_simple_testcase_fails_when_calling_get_url

 def test_simple_testcase_fails_when_calling_get_url(self):
     runner = Runner(mock.MagicMock())
     runner.context = Context(runner)
     SimpleTestRunner().patch_context(runner.context)
     SimpleTestRunner().setup_testclass(runner.context)
     with pytest.raises(AssertionError):
         runner.context.get_url()
開發者ID:bittner,項目名稱:behave-django,代碼行數:7,代碼來源:test_simple_testcase.py

示例4: handle

def handle(path):
    file_conf = ConfigObj(os.path.join(path, 'features', 'config.ini'))
    behave_options = file_conf['behave']['options']

    conf = Configuration(behave_options)
    conf.paths = [os.path.join(path, 'features')]
    runner = Runner(conf)
    runner.run()
開發者ID:Cito,項目名稱:zato-apitest,代碼行數:8,代碼來源:run.py

示例5: runTest

 def runTest(self, result=None):
     """Run behave on a single directory."""
     # from behave/__main__.py
     runner = Runner(self.behave_config)
     try:
         failed = runner.run()
     except ParserError, e:
         sys.exit(str(e))
開發者ID:jaydev,項目名稱:django-behave,代碼行數:8,代碼來源:runner.py

示例6: runTest

 def runTest(self, result=None):
     print "run: features_dir=%s" % (self.features_dir)
     stream = self.behave_config.output
     runner = Runner(self.behave_config)
     try:
         failed = runner.run()
     except ParserError, e:
         sys.exit(str(e))
開發者ID:mattjmorrison,項目名稱:icc2012-rolodex-service,代碼行數:8,代碼來源:runner.py

示例7: main

def main():
    # pylint: disable=R0912,R0915
    #   R0912   Too many branches (17/12)
    #   R0915   Too many statements (57/50)
    config = Configuration()

    if config.version:
        print "behave " + __version__
        sys.exit(0)

    if config.tags_help:
        print TAG_HELP
        sys.exit(0)

    if config.lang_list:
        iso_codes = languages.keys()
        iso_codes.sort()
        print "Languages available:"
        for iso_code in iso_codes:
            native = languages[iso_code]["native"][0]
            name = languages[iso_code]["name"][0]
            print u"%s: %s / %s" % (iso_code, native, name)
        sys.exit(0)

    if config.lang_help:
        if config.lang_help not in languages:
            sys.exit("%s is not a recognised language: try --lang-list" % config.lang_help)
        trans = languages[config.lang_help]
        print u"Translations for %s / %s" % (trans["name"][0], trans["native"][0])
        for kw in trans:
            if kw in "name native".split():
                continue
            print u"%16s: %s" % (kw.title().replace("_", " "), u", ".join(w for w in trans[kw] if w != "*"))
        sys.exit(0)

    if not config.format:
        format0 = config.defaults["format0"]
        config.format = [format0]
    elif "help" in config.format:
        print "Available formatters:"
        formatters.list_formatters(sys.stdout)
        sys.exit(0)
    # -- SANITY: Use at most one formatter, more cause various problems.
    # PROBLEM DESCRIPTION:
    #   1. APPEND MODE: configfile.format + --format
    #   2. Daisy chaining of formatters does not work
    #     => behave.formatter.formatters.get_formatter()
    #     => Stream methods, stream.write(), stream.flush are missing
    #        in Formatter interface
    config.format = config.format[-1:]

    stream = config.output
    runner = Runner(config)
    try:
        failed = runner.run()
    except ParserError, e:
        sys.exit(str(e))
開發者ID:hangtwenty,項目名稱:behave,代碼行數:57,代碼來源:main.py

示例8: main

def main():
    config = Configuration()

    if config.version:
        print "behave " + __version__
        sys.exit(0)

    if config.tags_help:
        print TAG_HELP
        sys.exit(0)

    if config.lang_list:
        iso_codes = languages.keys()
        iso_codes.sort()
        print "Languages available:"
        for iso_code in iso_codes:
            native = languages[iso_code]['native'][0]
            name = languages[iso_code]['name'][0]
            print u'%s: %s / %s' % (iso_code, native, name)
        sys.exit(0)

    if config.lang_help:
        if config.lang_help not in languages:
            sys.exit('%s is not a recognised language: try --lang-list' %
                     config.lang_help)
        trans = languages[config.lang_help]
        print u"Translations for %s / %s" % (trans['name'][0],
              trans['native'][0])
        for kw in trans:
            if kw in 'name native'.split():
                continue
            print u'%16s: %s' % (kw.title().replace('_', ' '),
                  u', '.join(w for w in trans[kw] if w != '*'))
        sys.exit(0)

    if not config.format:
        format0 = config.defaults["format0"]
        config.format = [ format0 ]
    elif 'help' in config.format:
        print "Available formatters:"
        formatters.list_formatters(sys.stdout)
        sys.exit(0)
    # -- SANITY: Use at most one formatter, more cause various problems.
    # PROBLEM DESCRIPTION:
    #   1. APPEND MODE: configfile.format + --format
    #   2. Daisy chaining of formatter does not work
    #     => behave.formatter.formatters.get_formatter()
    #     => Stream methods, stream.write(), stream.flush are missing
    #        in Formatter interface
    if DISABLE_MULTI_FORMATTERS:
        config.format = config.format[-1:]

    runner = Runner(config)
    try:
        failed = runner.run()
    except ParserError, e:
        sys.exit(str(e))
開發者ID:jgr21,項目名稱:behave,代碼行數:57,代碼來源:__main__.py

示例9: main

def main():
    config = Configuration()

    if config.version:
        print "behave " + __version__
        sys.exit(0)

    if config.tags_help:
        print TAG_HELP
        sys.exit(0)

    if config.lang_list:
        iso_codes = languages.keys()
        iso_codes.sort()
        print "Languages available:"
        for iso_code in iso_codes:
            native = languages[iso_code]["native"][0]
            name = languages[iso_code]["name"][0]
            print u"%s: %s / %s" % (iso_code, native, name)
        sys.exit(0)

    if config.lang_help:
        if config.lang_help not in languages:
            sys.exit("%s is not a recognised language: try --lang-list" % config.lang_help)
        trans = languages[config.lang_help]
        print u"Translations for %s / %s" % (trans["name"][0], trans["native"][0])
        for kw in trans:
            if kw in "name native".split():
                continue
            print u"%16s: %s" % (kw.title().replace("_", " "), u", ".join(w for w in trans[kw] if w != "*"))
        sys.exit(0)

    if not config.format:
        default_format = config.defaults["default_format"]
        config.format = [default_format]
    elif config.format and "format" in config.defaults:
        # -- CASE: Formatter are specified in behave configuration file.
        #    Check if formatter are provided on command-line, too.
        if len(config.format) == len(config.defaults["format"]):
            # -- NO FORMATTER on command-line: Add default formatter.
            default_format = config.defaults["default_format"]
            config.format.append(default_format)
    if "help" in config.format:
        print "Available formatters:"
        formatters.list_formatters(sys.stdout)
        sys.exit(0)

    if len(config.outputs) > len(config.format):
        print "CONFIG-ERROR: More outfiles (%d) than formatters (%d)." % (len(config.outputs), len(config.format))
        sys.exit(1)

    runner = Runner(config)
    try:
        failed = runner.run()
    except ParserError, e:
        sys.exit("ParseError: %s" % e)
開發者ID:vhumpa,項目名稱:behave,代碼行數:56,代碼來源:__main__.py

示例10: runTest

        def runTest(self, result=None):
            # run behave on a single directory
            print "run: features_dir=%s" % (self.features_dir)

            # from behave/__main__.py
            runner = Runner(self.behave_config)
            try:
                failed = runner.run()
            except ParserError, e:
                sys.exit(str(e))
開發者ID:scottferg,項目名稱:django-jenkins,代碼行數:10,代碼來源:behave_tests.py

示例11: runTest

    def runTest(self, result=None):
        # run behave on a single directory

        # from behave/__main__.py
        #stream = self.behave_config.output
        runner = BehaveRunner(self.behave_config)
        try:
            failed = runner.run()
        except ParserError, e:
            sys.exit(str(e))
開發者ID:Mondego,項目名稱:pyreco,代碼行數:10,代碼來源:allPythonContent.py

示例12: runTest

    def runTest(self, result=None):
        DjangoTestCaseAccessor.test_case = self
        # run behave on a single directory
        print "Run test in transaction for feature_paths=%s" % self.feature_paths

        # from behave/__main__.py
        runner = Runner(self.behave_config)
        try:
            failed = runner.run()
        except ParserError, e:
            sys.exit(str(e))
開發者ID:mackeian,項目名稱:django-behave,代碼行數:11,代碼來源:runner.py

示例13: handle

def handle(path, args=None):
    file_conf = ConfigObj(os.path.join(path, "features", "config.ini"))
    try:
        behave_options = file_conf["behave"]["options"]
    except KeyError:
        raise ValueError("Behave config not found." " Are you running with the right path?")
    if args:
        behave_options += " " + " ".join(args)

    conf = Configuration(behave_options)
    conf.paths = [os.path.join(path, "features")]
    runner = Runner(conf)
    runner.run()
開發者ID:universsky,項目名稱:zato-apitest,代碼行數:13,代碼來源:run.py

示例14: handle

def handle(path, args=None):
    file_conf = ConfigObj(os.path.join(path, 'features', 'config.ini'))
    try:
        behave_options = file_conf['behave']['options']
    except KeyError:
        raise ValueError("Behave config not found."
            " Are you running with the right path?")
    if args:
        behave_options += ' ' + ' '.join(args)

    conf = Configuration(behave_options)
    conf.paths = [os.path.join(path, 'features')]
    runner = Runner(conf)
    return runner.run()
開發者ID:zatosource,項目名稱:zato-apitest,代碼行數:14,代碼來源:run.py

示例15: run_model_with_cmdline

def run_model_with_cmdline(model, cmdline):
    reset_model(model.features)
    command_args = cmdline
    config = Configuration(command_args,
                           load_config=False,
                           default_format="null",
                           stdout_capture=True,
                           stderr_capture=True,
                           log_capture=False,
                           junit=True)
    model_runner = ModelRunner(config, model.features)
    runner = Runner(model_runner)
    runner.setup_paths()
    return runner.run()
開發者ID:salmon,項目名稱:somethingmess,代碼行數:14,代碼來源:behave_model.py


注:本文中的behave.runner.Runner類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。