Code Duplication    Length = 13-13 lines in 2 locations

tests/test_storage.py 1 location

@@ 143-155 (lines=13) @@
140
    return MockSession(name_format)
141
142
143
def make_logger(sess):
144
    output = StringIO()
145
    sess.logger = Namespace(
146
        warn=lambda code, text, **opts: output.write(u"%s: %s %s\n" % (code, force_text(text), opts)),
147
        info=lambda text, **opts: output.write(force_text(text) + u'\n'),
148
        error=lambda text: output.write(force_text(text) + u'\n'),
149
    )
150
    sess.storage.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
    return output
156
157
158
def test_rendering(sess):

tests/test_elasticsearch_storage.py 1 location

@@ 137-149 (lines=13) @@
134
    if isinstance(text, text_type):
135
        return text.encode('utf-8')
136
    else:
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