root/trunk/twisted/plugins/twisted_trial.py

Revision 27875, 2.0 KB (checked in by jml, 8 months ago)

Merge subunit-4004: Add a subunit reporter to trial.

  • Authors: jml, robertc
  • Reviewers: exarkun, therve, thijs, radix
  • Fixes #4004

You can now run tests with trial --reporter=subunit and have Trial generate
subunit output. This output can then be used with other tools that parse
the subunit protocol.

Line 
1
2from zope.interface import implements
3
4from twisted.trial.itrial import IReporter
5from twisted.plugin import IPlugin
6
7class _Reporter(object):
8    implements(IPlugin, IReporter)
9
10    def __init__(self, name, module, description, longOpt, shortOpt, klass):
11        self.name = name
12        self.module = module
13        self.description = description
14        self.longOpt = longOpt
15        self.shortOpt = shortOpt
16        self.klass = klass
17
18
19Tree = _Reporter("Tree Reporter",
20                 "twisted.trial.reporter",
21                 description="verbose color output (default reporter)",
22                 longOpt="verbose",
23                 shortOpt="v",
24                 klass="TreeReporter")
25
26BlackAndWhite = _Reporter("Black-And-White Reporter",
27                          "twisted.trial.reporter",
28                          description="Colorless verbose output",
29                          longOpt="bwverbose",
30                          shortOpt="o",
31                          klass="VerboseTextReporter")
32
33Minimal = _Reporter("Minimal Reporter",
34                    "twisted.trial.reporter",
35                    description="minimal summary output",
36                    longOpt="summary",
37                    shortOpt="s",
38                    klass="MinimalReporter")
39
40Classic = _Reporter("Classic Reporter",
41                    "twisted.trial.reporter",
42                    description="terse text output",
43                    longOpt="text",
44                    shortOpt="t",
45                    klass="TextReporter")
46
47Timing = _Reporter("Timing Reporter",
48                   "twisted.trial.reporter",
49                   description="Timing output",
50                   longOpt="timing",
51                   shortOpt=None,
52                   klass="TimingTextReporter")
53
54Subunit = _Reporter("Subunit Reporter",
55                    "twisted.trial.reporter",
56                    description="subunit output",
57                    longOpt="subunit",
58                    shortOpt=None,
59                    klass="SubunitReporter")
Note: See TracBrowser for help on using the browser.