|
12 | 12 |
|
13 | 13 | class ReportingPlugin(object):
|
14 | 14 | """Common (optional) base or example for Graphwalker reporting plugins."""
|
| 15 | + |
15 | 16 | def __init__(self, **kw):
|
16 | 17 | self.context = kw
|
17 | 18 |
|
@@ -51,6 +52,7 @@ def attach_to_step(self, name, data):
|
51 | 52 |
|
52 | 53 | class Print(ReportingPlugin):
|
53 | 54 | """Print report to [output]; 'stdout', 'stderr' or object with write()."""
|
| 55 | + |
54 | 56 | outputs_map = {'stderr': sys.stderr, 'stdout': sys.stdout}
|
55 | 57 |
|
56 | 58 | def initiate(self, test_name):
|
@@ -88,6 +90,7 @@ def emit(self, message):
|
88 | 90 |
|
89 | 91 | class Log(Print):
|
90 | 92 | """Log report to (name or object) [logger], at [level]."""
|
| 93 | + |
91 | 94 | getLogger = staticmethod(logging.getLogger)
|
92 | 95 | levels = dict(
|
93 | 96 | (n, getattr(logging, n))
|
@@ -116,6 +119,7 @@ def emit(self, message, *al, **kw):
|
116 | 119 |
|
117 | 120 | class PathRecorder(ReportingPlugin):
|
118 | 121 | """Report steps to a file at [path]/[name], saving attachments by name."""
|
| 122 | + |
119 | 123 | file = file
|
120 | 124 |
|
121 | 125 | def __init__(self, **kw):
|
@@ -143,6 +147,7 @@ def finalize(self, failure=False):
|
143 | 147 |
|
144 | 148 | class Cartographer(ReportingPlugin):
|
145 | 149 | """Report graph and path steps to a graphviz file and run dot."""
|
| 150 | + |
146 | 151 | file = file
|
147 | 152 | system = os.system
|
148 | 153 | command = 'dot -T%(imgtype)s -o %(imgfname)s %(dotfname)s'
|
@@ -176,6 +181,7 @@ def step_begin(self, step):
|
176 | 181 |
|
177 | 182 | class Attachments(ReportingPlugin):
|
178 | 183 | """Save attachments to [path]/name."""
|
| 184 | + |
179 | 185 | file = file
|
180 | 186 |
|
181 | 187 | def attach_to_suite(self, name, data):
|
|
0 commit comments