def test_attempt_counter(tmpdir): request = Request(0, 1, path=str(tmpdir)) with open(os.path.join(request.path, 'attempt'), 'w') as f: print(2, file=f) request.incr_attempt() assert request.attempt == 3
def test_incr_attempt_should_create_counter_if_none(tmpdir): request = Request(0, 1, path=str(tmpdir)) request.incr_attempt() with open(os.path.join(request.path, 'attempt')) as f: assert f.read() == '1\n'