本文整理汇总了Python中tap.tracker.Tracker类的典型用法代码示例。如果您正苦于以下问题:Python Tracker类的具体用法?Python Tracker怎么用?Python Tracker使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Tracker类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_adds_skip
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:python-tap,项目名称:tappy,代码行数:7,代码来源:test_tracker.py
示例2: test_adds_not_ok
def test_adds_not_ok(self):
tracker = Tracker()
tracker.add_not_ok('FakeTestCase', 'a description')
line = tracker._test_cases['FakeTestCase'][0]
self.assertEqual(line.status, 'not ok')
self.assertEqual(line.description, 'a description')
self.assertEqual(line.directive, '')
开发者ID:CheeseTheMonkey,项目名称:tappy,代码行数:7,代码来源:test_tracker.py
示例3: test_adds_skip
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,代码行数:7,代码来源:test_tracker.py
示例4: test_streaming_writes_plan
def test_streaming_writes_plan(self):
stream = StringIO()
tracker = Tracker(streaming=True, stream=stream)
tracker.combined_line_number = 42
tracker.generate_tap_reports()
self.assertEqual(stream.getvalue(), '1..42\n')
开发者ID:,项目名称:,代码行数:8,代码来源:
示例5: test_write_plan_first_combined
def test_write_plan_first_combined(self):
outdir = tempfile.mkdtemp()
tracker = Tracker(streaming=False, outdir=outdir, combined=True)
tracker.set_plan(123)
tracker.generate_tap_reports()
with open(os.path.join(outdir, "testresults.tap"), "r") as f:
lines = f.readlines()
self.assertEqual(lines[0], "1..123\n")
开发者ID:python-tap,项目名称:tappy,代码行数:8,代码来源:test_tracker.py
示例6: test_generates_tap_reports_in_existing_outdir
def test_generates_tap_reports_in_existing_outdir(self):
outdir = tempfile.mkdtemp()
tracker = Tracker(outdir=outdir)
tracker.add_ok('FakeTestCase', 'I should be in the specified dir.')
tracker.generate_tap_reports()
tap_file = os.path.join(outdir, 'FakeTestCase.tap')
self.assertTrue(os.path.exists(tap_file))
开发者ID:,项目名称:,代码行数:9,代码来源:
示例7: test_does_not_write_header
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:,项目名称:,代码行数:9,代码来源:
示例8: test_streaming_does_not_write_files
def test_streaming_does_not_write_files(self):
outdir = tempfile.mkdtemp()
stream = StringIO()
tracker = Tracker(outdir=outdir, streaming=True, stream=stream)
tracker.add_ok("FakeTestCase", "YESSS!")
tracker.generate_tap_reports()
self.assertFalse(os.path.exists(os.path.join(outdir, "FakeTestCase.tap")))
开发者ID:python-tap,项目名称:tappy,代码行数:9,代码来源:test_tracker.py
示例9: test_generates_tap_reports_in_new_outdir
def test_generates_tap_reports_in_new_outdir(self):
tempdir = tempfile.mkdtemp()
outdir = os.path.join(tempdir, "non", "existent", "path")
tracker = Tracker(outdir=outdir)
tracker.add_ok("FakeTestCase", "I should be in the specified dir.")
tracker.generate_tap_reports()
tap_file = os.path.join(outdir, "FakeTestCase.tap")
self.assertTrue(os.path.exists(tap_file))
开发者ID:python-tap,项目名称:tappy,代码行数:10,代码来源:test_tracker.py
示例10: test_add_skip_writes_to_stream_while_streaming
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,代码行数:11,代码来源:test_tracker.py
示例11: test_add_skip_writes_to_stream_while_streaming
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:,项目名称:,代码行数:12,代码来源:
示例12: test_individual_report_has_no_plan_when_combined
def test_individual_report_has_no_plan_when_combined(self):
outdir = tempfile.mkdtemp()
tracker = Tracker(outdir=outdir, combined=True)
tracker.add_ok('FakeTestCase', 'Look ma, no plan!')
out_file = StringIO()
tracker.generate_tap_report(
'FakeTestCase', tracker._test_cases['FakeTestCase'], out_file)
report = out_file.getvalue()
self.assertTrue('Look ma' in report)
self.assertFalse('1..' in report)
开发者ID:,项目名称:,代码行数:12,代码来源:
示例13: test_add_not_ok_writes_to_stream_while_streaming
def test_add_not_ok_writes_to_stream_while_streaming(self):
stream = StringIO()
tracker = Tracker(streaming=True, stream=stream)
tracker.add_not_ok("FakeTestCase", "YESSS!")
expected = inspect.cleandoc(
"""{header}
not ok 1 YESSS!
""".format(
header=self._make_header("FakeTestCase")
)
)
self.assertEqual(stream.getvalue().strip(), expected)
开发者ID:python-tap,项目名称:tappy,代码行数:14,代码来源:test_tracker.py
示例14: test_add_ok_writes_to_stream_while_streaming
def test_add_ok_writes_to_stream_while_streaming(self):
stream = StringIO()
tracker = Tracker(streaming=True, stream=stream)
tracker.add_ok('FakeTestCase', 'YESSS!')
tracker.add_ok('AnotherTestCase', 'Sure.')
expected = inspect.cleandoc(
"""# TAP results for FakeTestCase
ok 1 - YESSS!
# TAP results for AnotherTestCase
ok 2 - Sure.
""")
self.assertEqual(stream.getvalue().strip(), expected)
开发者ID:pombredanne,项目名称:tappy,代码行数:14,代码来源:test_tracker.py
示例15: test_add_ok_writes_to_stream_while_streaming
def test_add_ok_writes_to_stream_while_streaming(self):
stream = StringIO()
tracker = Tracker(streaming=True, stream=stream)
tracker.add_ok('FakeTestCase', 'YESSS!')
tracker.add_ok('AnotherTestCase', 'Sure.')
expected = inspect.cleandoc(
"""{header_1}
ok 1 - YESSS!
{header_2}
ok 2 - Sure.
""".format(
header_1=self._make_header('FakeTestCase'),
header_2=self._make_header('AnotherTestCase')))
self.assertEqual(stream.getvalue().strip(), expected)
开发者ID:,项目名称:,代码行数:16,代码来源:
示例16: test_streaming_writes_tap_version_13
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,代码行数:16,代码来源:test_tracker.py
示例17: configure
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
开发者ID:sunny256,项目名称:tappy,代码行数:7,代码来源:_nose.py
示例18: test_combined_results_in_one_file_tap_version_12
def test_combined_results_in_one_file_tap_version_12(self):
outdir = tempfile.mkdtemp()
tracker = Tracker(outdir=outdir, combined=True)
tracker.add_ok("FakeTestCase", "YESSS!")
tracker.add_ok("DifferentFakeTestCase", "GOAAL!")
tracker.generate_tap_reports()
self.assertFalse(os.path.exists(os.path.join(outdir, "FakeTestCase.tap")))
self.assertFalse(
os.path.exists(os.path.join(outdir, "DifferentFakeTestCase.tap"))
)
with open(os.path.join(outdir, "testresults.tap"), "r") as f:
report = f.read()
expected = inspect.cleandoc(
"""{header_1}
ok 1 YESSS!
{header_2}
ok 2 GOAAL!
1..2
""".format(
header_1=self._make_header("FakeTestCase"),
header_2=self._make_header("DifferentFakeTestCase"),
)
)
self.assertEqual(report.strip(), expected)
开发者ID:python-tap,项目名称:tappy,代码行数:26,代码来源:test_tracker.py
示例19: test_add_ok_writes_to_stream_while_streaming
def test_add_ok_writes_to_stream_while_streaming(self):
stream = StringIO()
tracker = Tracker(streaming=True, stream=stream)
tracker.add_ok("FakeTestCase", "YESSS!")
tracker.add_ok("AnotherTestCase", "Sure.")
expected = inspect.cleandoc(
"""{header_1}
ok 1 YESSS!
{header_2}
ok 2 Sure.
""".format(
header_1=self._make_header("FakeTestCase"),
header_2=self._make_header("AnotherTestCase"),
)
)
self.assertEqual(stream.getvalue().strip(), expected)
开发者ID:python-tap,项目名称:tappy,代码行数:18,代码来源:test_tracker.py
示例20: TAP
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,代码行数:42,代码来源:plugin.py
注:本文中的tap.tracker.Tracker类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论