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 CoverageReporter. The reporter itself
8 # lives separately, in src/allmydata/test/trial_figleaf.py
10 # note that this allmydata_trial.py file is *not* in a package: there is no
11 # __init__.py in our parent directory. This is important, because otherwise
12 # ours would fight with Twisted's. When trial looks for plugins, it merely
13 # executes all the *.py files it finds in any twisted/plugins/ subdirectories
14 # of anything on sys.path . The namespace that results from executing these
15 # .py files is examined for instances which provide both IPlugin and the
16 # target interface (in this case, trial is looking for IReporter instances).
17 # Each such instance tells the application how to create a plugin by naming
18 # the module 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 bwcov = _Reporter("Code-Coverage Reporter (colorless)",
36 "allmydata.test.trial_coverage",
37 description="Colorless verbose output (with 'coverage' coverage)",
38 longOpt="bwverbose-coverage",
40 klass="CoverageTextReporter")