Code Duplication    Length = 13-13 lines in 2 locations

tests/test_storage.py 1 location

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

tests/test_elasticsearch_storage.py 1 location

@@ 137-149 (lines=13) @@
134
        return text
135
136
137
def make_logger(sess):
138
    output = StringIO()
139
    sess.logger = Namespace(
140
        warn=lambda code, text, **opts: output.write(u"%s: %s %s\n" % (code, force_text(text), opts)),
141
        info=lambda text, **opts: output.write(force_text(text) + u'\n'),
142
        error=lambda text: output.write(force_text(text) + u'\n'),
143
    )
144
    sess.report_backend.logger = Namespace(
145
        warn=lambda code, text, **opts: output.write(u"%s: %s %s\n" % (code, force_text(text), opts)),
146
        info=lambda text, **opts: output.write(force_text(text) + u'\n'),
147
        error=lambda text: output.write(force_text(text) + u'\n'),
148
    )
149
    return output
150
151
152
@pytest.fixture