]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/blob - twisted/plugins/allmydata_trial.py
Update .PHONY declarations in Makefile.
[tahoe-lafs/tahoe-lafs.git] / twisted / plugins / allmydata_trial.py
1 #! /usr/bin/env python
2
3 from zope.interface import implements
4 from twisted.trial.itrial import IReporter
5 from twisted.plugin import IPlugin
6
7 # register a plugin that can create our CoverageReporter. The reporter itself
8 # lives separately, in src/allmydata/test/trial_coverage.py
9
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.
19
20 # When installing our package via setup.py, arrange for this file to be
21 # installed to the system-wide twisted/plugins/ directory.
22
23 class _Reporter(object):
24     implements(IPlugin, IReporter)
25
26     def __init__(self, name, module, description, longOpt, shortOpt, klass):
27         self.name = name
28         self.module = module
29         self.description = description
30         self.longOpt = longOpt
31         self.shortOpt = shortOpt
32         self.klass = klass
33
34
35 bwcov = _Reporter("Code-Coverage Reporter (colorless)",
36                   "allmydata.test.trial_coverage",
37                   description="Colorless verbose output (with 'coverage' coverage)",
38                   longOpt="bwverbose-coverage",
39                   shortOpt=None,
40                   klass="CoverageTextReporter")
41