]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/blob - twisted/plugins/allmydata_trial.py
275bbb24d1154218518347ea8d256d61ba251d30
[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 FigleafReporter. The reporter itself
8 # lives in a separate place
9
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.
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 fig = _Reporter("Figleaf Code-Coverage Reporter",
36                 "allmydata.test.trial_figleaf",
37                 description="verbose color output (with figleaf coverage)",
38                 longOpt="verbose-figleaf",
39                 shortOpt="f",
40                 klass="FigleafReporter")
41
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",
46                   shortOpt=None,
47                   klass="FigleafTextReporter")
48