| @@ 140-152 (lines=13) @@ | ||
| 137 | return text |
|
| 138 | ||
| 139 | ||
| 140 | def make_logger(sess): |
|
| 141 | output = StringIO() |
|
| 142 | sess.logger = Namespace( |
|
| 143 | warn=lambda code, text, **opts: output.write(u"%s: %s %s\n" % (code, force_text(text), opts)), |
|
| 144 | info=lambda text, **opts: output.write(force_text(text) + u'\n'), |
|
| 145 | error=lambda text: output.write(force_text(text) + u'\n'), |
|
| 146 | ) |
|
| 147 | sess.storage.logger = Namespace( |
|
| 148 | warn=lambda code, text, **opts: output.write(u"%s: %s %s\n" % (code, force_text(text), opts)), |
|
| 149 | info=lambda text, **opts: output.write(force_text(text) + u'\n'), |
|
| 150 | error=lambda text: output.write(force_text(text) + u'\n'), |
|
| 151 | ) |
|
| 152 | return output |
|
| 153 | ||
| 154 | ||
| 155 | @pytest.fixture |
|
| @@ 148-160 (lines=13) @@ | ||
| 145 | return MockSession(name_format) |
|
| 146 | ||
| 147 | ||
| 148 | def make_logger(sess): |
|
| 149 | output = StringIO() |
|
| 150 | sess.logger = Namespace( |
|
| 151 | warn=lambda code, text, **opts: output.write(u"%s: %s %s\n" % (code, force_text(text), opts)), |
|
| 152 | info=lambda text, **opts: output.write(force_text(text) + u'\n'), |
|
| 153 | error=lambda text: output.write(force_text(text) + u'\n'), |
|
| 154 | ) |
|
| 155 | sess.storage.logger = Namespace( |
|
| 156 | warn=lambda code, text, **opts: output.write(u"%s: %s %s\n" % (code, force_text(text), opts)), |
|
| 157 | info=lambda text, **opts: output.write(force_text(text) + u'\n'), |
|
| 158 | error=lambda text: output.write(force_text(text) + u'\n'), |
|
| 159 | ) |
|
| 160 | return output |
|
| 161 | ||
| 162 | ||
| 163 | def test_rendering(sess): |
|