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


Python Tracker.add_skip方法代码示例

本文整理汇总了Python中tap.tracker.Tracker.add_skip方法的典型用法代码示例。如果您正苦于以下问题:Python Tracker.add_skip方法的具体用法?Python Tracker.add_skip怎么用?Python Tracker.add_skip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tap.tracker.Tracker的用法示例。


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

示例1: test_adds_skip

# 需要导入模块: from tap.tracker import Tracker [as 别名]
# 或者: from tap.tracker.Tracker import add_skip [as 别名]
 def test_adds_skip(self):
     tracker = Tracker()
     tracker.add_skip('FakeTestCase', 'a description', 'a reason')
     line = tracker._test_cases['FakeTestCase'][0]
     self.assertTrue(line.ok)
     self.assertEqual(line.description, 'a description')
     self.assertEqual(line.directive.text, 'SKIP a reason')
开发者ID:,项目名称:,代码行数:9,代码来源:

示例2: test_adds_skip

# 需要导入模块: from tap.tracker import Tracker [as 别名]
# 或者: from tap.tracker.Tracker import add_skip [as 别名]
 def test_adds_skip(self):
     tracker = Tracker()
     tracker.add_skip('FakeTestCase', 'a description', 'a reason')
     line = tracker._test_cases['FakeTestCase'][0]
     self.assertEqual(line.status, 'ok')
     self.assertEqual(line.description, 'a description')
     self.assertEqual(line.directive, '# SKIP a reason')
开发者ID:CheeseTheMonkey,项目名称:tappy,代码行数:9,代码来源:test_tracker.py

示例3: test_does_not_write_header

# 需要导入模块: from tap.tracker import Tracker [as 别名]
# 或者: from tap.tracker.Tracker import add_skip [as 别名]
    def test_does_not_write_header(self):
        stream = StringIO()
        tracker = Tracker(streaming=True, stream=stream, header=False)

        tracker.add_skip('FakeTestCase', 'YESSS!', 'a reason')

        expected = inspect.cleandoc(
            """ok 1 - YESSS! # SKIP a reason""")
        self.assertEqual(stream.getvalue().strip(), expected)
开发者ID:,项目名称:,代码行数:11,代码来源:

示例4: test_add_skip_writes_to_stream_while_streaming

# 需要导入模块: from tap.tracker import Tracker [as 别名]
# 或者: from tap.tracker.Tracker import add_skip [as 别名]
    def test_add_skip_writes_to_stream_while_streaming(self):
        stream = StringIO()
        tracker = Tracker(streaming=True, stream=stream)

        tracker.add_skip('FakeTestCase', 'YESSS!', 'a reason')

        expected = inspect.cleandoc(
            """# TAP results for FakeTestCase
            ok 1 - YESSS! # SKIP a reason
            """)
        self.assertEqual(stream.getvalue().strip(), expected)
开发者ID:pombredanne,项目名称:tappy,代码行数:13,代码来源:test_tracker.py

示例5: test_add_skip_writes_to_stream_while_streaming

# 需要导入模块: from tap.tracker import Tracker [as 别名]
# 或者: from tap.tracker.Tracker import add_skip [as 别名]
    def test_add_skip_writes_to_stream_while_streaming(self):
        stream = StringIO()
        tracker = Tracker(streaming=True, stream=stream)

        tracker.add_skip('FakeTestCase', 'YESSS!', 'a reason')

        expected = inspect.cleandoc(
            """{header}
            ok 1 - YESSS! # SKIP a reason
            """.format(
                header=self._make_header('FakeTestCase')))
        self.assertEqual(stream.getvalue().strip(), expected)
开发者ID:,项目名称:,代码行数:14,代码来源:

示例6: test_streaming_writes_tap_version_13

# 需要导入模块: from tap.tracker import Tracker [as 别名]
# 或者: from tap.tracker.Tracker import add_skip [as 别名]
    def test_streaming_writes_tap_version_13(self):
        stream = StringIO()
        tracker = Tracker(streaming=True, stream=stream)

        tracker.add_skip("FakeTestCase", "YESSS!", "a reason")

        expected = inspect.cleandoc(
            """
            TAP version 13
            {header}
            ok 1 YESSS! # SKIP a reason
            """.format(
                header=self._make_header("FakeTestCase")
            )
        )
        self.assertEqual(stream.getvalue().strip(), expected)
开发者ID:python-tap,项目名称:tappy,代码行数:18,代码来源:test_tracker.py

示例7: TAPTestResult

# 需要导入模块: from tap.tracker import Tracker [as 别名]
# 或者: from tap.tracker.Tracker import add_skip [as 别名]
class TAPTestResult(TextTestResult):

    # This attribute will store the user's desired output directory.
    OUTDIR = None

    def __init__(self, stream, descriptions, verbosity):
        super(TAPTestResult, self).__init__(stream, descriptions, verbosity)
        self.tracker = Tracker(outdir=self.OUTDIR)

    def stopTestRun(self):
        """Once the test run is complete, generate each of the TAP files."""
        super(TAPTestResult, self).stopTestRun()
        self.tracker.generate_tap_reports()

    def addError(self, test, err):
        super(TAPTestResult, self).addError(test, err)
        self.tracker.add_not_ok(self._cls_name(test), self._description(test))

    def addFailure(self, test, err):
        super(TAPTestResult, self).addFailure(test, err)
        self.tracker.add_not_ok(self._cls_name(test), self._description(test))

    def addSuccess(self, test):
        super(TAPTestResult, self).addSuccess(test)
        self.tracker.add_ok(self._cls_name(test), self._description(test))

    def addSkip(self, test, reason):
        super(TAPTestResult, self).addSkip(test, reason)
        self.tracker.add_skip(
            self._cls_name(test), self._description(test), reason)

    def addExpectedFailure(self, test, err):
        super(TAPTestResult, self).addExpectedFailure(test, err)
        self.tracker.add_not_ok(self._cls_name(test), self._description(test),
                                '(expected failure)')

    def addUnexpectedSuccess(self, test):
        super(TAPTestResult, self).addUnexpectedSuccess(test)
        self.tracker.add_ok(self._cls_name(test), self._description(test),
                            '(unexpected success)')

    def _cls_name(self, test):
        return test.__class__.__name__

    def _description(self, test):
        return test.shortDescription() or str(test)
开发者ID:msabramo,项目名称:tappy,代码行数:48,代码来源:runner.py

示例8: TAP

# 需要导入模块: from tap.tracker import Tracker [as 别名]
# 或者: from tap.tracker.Tracker import add_skip [as 别名]
class TAP(Plugin):
    """This plugin provides test results in the Test Anything Protocol format.
    """
    name = 'tap'

    def options(self, parser, env=os.environ):
        super(TAP, self).options(parser, env=env)
        parser.add_option(
            '--tap-outdir',
            help='An optional output directory to write TAP files to. If the'
                 ' directory does not exist, it will be created.')

    def configure(self, options, conf):
        super(TAP, self).configure(options, conf)
        if self.enabled:
            self.tracker = Tracker(outdir=options.tap_outdir)

    def finalize(self, results):
        self.tracker.generate_tap_reports()

    def addError(self, test, err):
        err_cls, reason, _ = err
        if err_cls != SkipTest:
            self.tracker.add_not_ok(
                self._cls_name(test), self._description(test))
        else:
            self.tracker.add_skip(
                self._cls_name(test), self._description(test), reason)

    def addFailure(self, test, err):
        self.tracker.add_not_ok(self._cls_name(test), self._description(test))

    def addSuccess(self, test):
        self.tracker.add_ok(self._cls_name(test), self._description(test))

    def _cls_name(self, test):
        # nose masks the true test case name so the real class name is found
        # under the test attribute.
        return test.test.__class__.__name__

    def _description(self, test):
        return test.shortDescription() or str(test)
开发者ID:CheeseTheMonkey,项目名称:tappy,代码行数:44,代码来源:plugin.py

示例9: TAP

# 需要导入模块: from tap.tracker import Tracker [as 别名]
# 或者: from tap.tracker.Tracker import add_skip [as 别名]
class TAP(Plugin):
    """This plugin provides test results in the Test Anything Protocol format.
    """
    name = 'tap'

    def options(self, parser, env=os.environ):
        super(TAP, self).options(parser, env=env)
        parser.add_option(
            '--tap-stream', default=False, action='store_true',
            help=_('Stream TAP output instead of the default test runner'
                   ' output.'))
        parser.add_option(
            '--tap-outdir', metavar='PATH', help=_(
                'An optional output directory to write TAP files to. '
                'If the directory does not exist, it will be created.'))
        parser.add_option(
            '--tap-combined', default=False, action='store_true',
            help=_('Store all TAP test results into a combined output file.'))
        parser.add_option(
            '--tap-format', default='', metavar='FORMAT',
            help=_(
                'An optional format string for the TAP output.'
                ' The format options are:'
                ' {short_description} for the short description, and'
                ' {method_name} for the test method name.'))

    def configure(self, options, conf):
        super(TAP, self).configure(options, conf)
        if self.enabled:
            self.tracker = Tracker(
                outdir=options.tap_outdir, combined=options.tap_combined,
                streaming=options.tap_stream)
        self._format = options.tap_format

    def finalize(self, results):
        self.tracker.generate_tap_reports()

    def setOutputStream(self, stream):
        # When streaming is on, hijack the stream and return a dummy to send
        # standard nose output to oblivion.
        if self.tracker.streaming:
            self.tracker.stream = stream
            return DummyStream()
        return stream

    def addError(self, test, err):
        err_cls, reason, _ = err
        if err_cls != SkipTest:
            self.tracker.add_not_ok(
                self._cls_name(test), self._description(test))
        else:
            self.tracker.add_skip(
                self._cls_name(test), self._description(test), reason)

    def addFailure(self, test, err):
        self.tracker.add_not_ok(self._cls_name(test), self._description(test))

    def addSuccess(self, test):
        self.tracker.add_ok(self._cls_name(test), self._description(test))

    def _cls_name(self, test):
        if isinstance(test, ContextSuite):
            # In the class setup and teardown, test is a ContextSuite
            # instead of a test case. Grab the name from the context.
            return test.context.__name__
        else:
            # nose masks the true test case name so the real class name
            # is found under the test attribute.
            return test.test.__class__.__name__

    def _description(self, test):
        if self._format:
            try:
                return self._format.format(
                    method_name=str(test),
                    short_description=test.shortDescription() or '')
            except KeyError:
                sys.exit(_(
                    'Bad format string: {format}\n'
                    'Replacement options are: {{short_description}} and '
                    '{{method_name}}').format(format=self._format))

        return test.shortDescription() or str(test)
开发者ID:sunny256,项目名称:tappy,代码行数:85,代码来源:_nose.py


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