3 from zope.interface import implements
4 from twisted.trial.itrial import IReporter
5 from twisted.plugin import IPlugin
7 # register a plugin that can create our FigleafReporter. The reporter itself
8 # lives in a separate place
10 # note that this .py file is *not* in a package: there is no __init__.py in
11 # our parent directory. This is important, because otherwise ours would fight
12 # with Twisted's. When trial looks for plugins, it merely executes all the
13 # *.py files it finds in any twisted/plugins/ subdirectories of anything on
14 # sys.path . The namespace that results from executing these .py files is
15 # examined for instances which provide both IPlugin and the target interface
16 # (in this case, trial is looking for IReporter instances). Each such
17 # instance tells the application how to create a plugin by naming the module
18 # and class that should be instantiated.
20 # When installing our package via setup.py, arrange for this file to be
21 # installed to the system-wide twisted/plugins/ directory.
23 class _Reporter(object):
24 implements(IPlugin, IReporter)
26 def __init__(self, name, module, description, longOpt, shortOpt, klass):
29 self.description = description
30 self.longOpt = longOpt
31 self.shortOpt = shortOpt
35 fig = _Reporter("Figleaf Code-Coverage Reporter",
36 "allmydata.test.trial_figleaf",
37 description="verbose color output (with figleaf coverage)",
38 longOpt="verbose-figleaf",
40 klass="FigleafReporter")
42 bwfig = _Reporter("Figleaf Code-Coverage Reporter (colorless)",
43 "allmydata.test.trial_figleaf",
44 description="Colorless verbose output (with figleaf coverage)",
45 longOpt="bwverbose-figleaf",
47 klass="FigleafTextReporter")