Code Duplication    Length = 23-24 lines in 2 locations

tests/test_storage.py 2 locations

@@ 318-341 (lines=24) @@
315
    ])
316
317
318
def test_compare_2(sess, LineMatcher):
319
    output = make_logger(sess)
320
    sess.report_backend.compare = '0002'
321
    sess.report_backend.handle_loading(sess.machine_info)
322
    sess.finish()
323
    sess.display(Namespace(
324
        ensure_newline=lambda: None,
325
        write_line=lambda line, **opts: output.write(force_text(line) + u'\n'),
326
        section=lambda line, **opts: output.write(force_text(line) + u'\n'),
327
        write=lambda text, **opts: output.write(force_text(text)),
328
        rewrite=lambda text, **opts: output.write(force_text(text)),
329
    ))
330
    print(output.getvalue())
331
    LineMatcher(output.getvalue().splitlines()).fnmatch_lines([
332
        'BENCHMARK-C6: Benchmark machine_info is different. Current: {foo: "bar"} VS saved: {machine: "x86_64", node: "minibox", processor: "x86_64", python_compiler: "GCC 4.6.3", python_implementation: "CPython", python_version: "2.7.3", release: "3.13.0-55-generic", system: "Linux"}. {\'fslocation\': \'tests*test_storage\'}',
333
        'Comparing against benchmarks from: 0002_b87b9aae14ff14a7887a6bbaa9731b9a8760555d_20150814_190348_uncommitted-changes.json',
334
        '',
335
        '*------------------------------------------------------------------------ benchmark: 2 tests -----------------------------------------------------------------------*',
336
        'Name (time in ns)            *         Min                 *Max                Mean              StdDev              Median                IQR            Outliers(*)  Rounds  Iterations',
337
        '--------------------------------------------------------------------------------------------------------------------------------------------------------------------*',
338
        '*xfast_parametrized[[]0[]] (0002*)     216.9028 (1.0)       7*739.2997 (1.0)      254.0585 (1.0)        0.0000 (1.0)      219.8103 (1.0)      27.3309 (1.45)        235;1688   11009         410',
339
        '*xfast_parametrized[[]0[]] (NOW) *     217.9511 (1.00)     13*290.0380 (1.72)     261.2051 (1.03)     263.9842 (inf)      220.1638 (1.00)     18.8080 (1.0)         160;1726    9710         431',
340
        '--------------------------------------------------------------------------------------------------------------------------------------------------------------------*',
341
        '(*) Outliers: 1 Standard Deviation from Mean; 1.5 IQR (InterQuartile Range) from 1st Quartile and 3rd Quartile.',
342
    ])
343
344
@freeze_time("2015-08-15T00:04:18.687119")
@@ 292-314 (lines=23) @@
289
    }[name_format]
290
291
292
def test_compare_1(sess, LineMatcher):
293
    output = make_logger(sess)
294
    sess.report_backend.handle_loading(sess.machine_info)
295
    sess.finish()
296
    sess.display(Namespace(
297
        ensure_newline=lambda: None,
298
        write_line=lambda line, **opts: output.write(force_text(line) + u'\n'),
299
        write=lambda text, **opts: output.write(force_text(text)),
300
        rewrite=lambda text, **opts: output.write(force_text(text)),
301
    ))
302
    print(output.getvalue())
303
    LineMatcher(output.getvalue().splitlines()).fnmatch_lines([
304
        'BENCHMARK-C6: Benchmark machine_info is different. Current: {foo: "bar"} VS saved: {machine: "x86_64", node: "minibox", processor: "x86_64", python_compiler: "GCC 4.6.3", python_implementation: "CPython", python_version: "2.7.3", release: "3.13.0-55-generic", system: "Linux"}. {\'fslocation\': \'tests*test_storage\'}',
305
        'Comparing against benchmarks from: 0001_b87b9aae14ff14a7887a6bbaa9731b9a8760555d_20150814_190343_uncommitted'
306
        '-changes.json',
307
        '',
308
        '*------------------------------------------------------------------------ benchmark: 2 tests -----------------------------------------------------------------------*',
309
        'Name (time in ns)               *      Min                 *Max                Mean              StdDev              Median                IQR            Outliers(*)  Rounds  Iterations',
310
        '--------------------------------------------------------------------------------------------------------------------------------------------------------------------*',
311
        '*xfast_parametrized[[]0[]] (0001*)     217.3145 (1.0)      11*447.3891 (1.0)      262.2408 (1.00)     214.0442 (1.0)      220.1664 (1.00)     38.2154 (2.03)         90;1878    9987         418',
312
        '*xfast_parametrized[[]0[]] (NOW) *     217.9511 (1.00)     13*290.0380 (1.16)     261.2051 (1.0)      263.9842 (1.23)     220.1638 (1.0)      18.8080 (1.0)         160;1726    9710         431',
313
        '--------------------------------------------------------------------------------------------------------------------------------------------------------------------*',
314
        '(*) Outliers: 1 Standard Deviation from Mean; 1.5 IQR (InterQuartile Range) from 1st Quartile and 3rd Quartile.',
315
    ])
316
317