Code Duplication    Length = 12-14 lines in 2 locations

tests/test_storage.py 2 locations

@@ 375-388 (lines=14) @@
372
    sess.json = None
373
    sess.save_data = False
374
    sess.storage.path = Path(str(tmpdir))
375
    sess.handle_saving()
376
    files = list(Path(str(tmpdir)).rglob('*.json'))
377
    assert len(files) == 1
378
    assert json.load(files[0].open('rU')) == SAVE_DATA
379
380
381
@freeze_time("2015-08-15T00:04:18.687119")
382
def test_save_with_error(sess, tmpdir, monkeypatch):
383
    monkeypatch.setattr(plugin, '__version__', '2.5.0')
384
    sess.save = True
385
    sess.autosave = True
386
    sess.json = None
387
    sess.save_data = False
388
    sess.storage.path = Path(str(tmpdir))
389
    for bench in sess.benchmarks:
390
        bench.has_error = True
391
    sess.handle_saving()
@@ 347-358 (lines=12) @@
344
    sess.autosave = False
345
    sess.json = LooseFileLike()
346
    sess.save_data = False
347
    sess.handle_saving()
348
    assert tmpdir.listdir() == []
349
    assert json.loads(sess.json.getvalue().decode()) == JSON_DATA
350
351
352
@freeze_time("2015-08-15T00:04:18.687119")
353
def test_save_with_name(sess, tmpdir, monkeypatch):
354
    monkeypatch.setattr(plugin, '__version__', '2.5.0')
355
    sess.save = 'foobar'
356
    sess.autosave = True
357
    sess.json = None
358
    sess.save_data = False
359
    sess.storage.path = Path(str(tmpdir))
360
    sess.handle_saving()
361
    files = list(Path(str(tmpdir)).rglob('*.json'))