Skip to content

Commit

Permalink
Add test for backups at "log_to" init
Browse files Browse the repository at this point in the history
  • Loading branch information
Delgan committed Oct 28, 2017
1 parent b7d4f27 commit d5e9534
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/test_rotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,16 @@ def test_backups_function(tmpdir, logger):
assert len(tmpdir.listdir()) == 1
assert tmpdir.join('test.log').read() == '%d\n' % i

def test_backups_at_initialization(tmpdir, logger):
for i in reversed(range(1, 10)):
tmpdir.join('test.log.%d' % i).write(str(i))

logger.log_to(tmpdir.join('test.log'), backups=1)

assert len(tmpdir.listdir()) == 2
assert tmpdir.join('test.log').read() == ''
assert tmpdir.join('test.log.1').read() == '1'

@pytest.mark.parametrize('previous', [1, 5, 9, 20])
def test_backups_with_previous_files(tmpdir, logger, previous):
log_count = 5
Expand Down

0 comments on commit d5e9534

Please sign in to comment.