1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-26 09:47:58 +00:00

use monkeypatch

This commit is contained in:
Abogical 2016-11-14 15:10:01 +02:00
parent 76638d0562
commit 3896f26ab2

View file

@ -903,9 +903,10 @@ def test_yes_env_output(capfd, monkeypatch):
assert 'yes' in err
def test_progress_percentage_sameline(capfd):
os.environ['COLUMNS'] = '4'
os.environ['LINES'] = '1'
def test_progress_percentage_sameline(capfd, monkeypatch):
# run the test as if it was in a 4x1 terminal
monkeypatch.setenv('COLUMNS', '4')
monkeypatch.setenv('LINES', '1')
pi = ProgressIndicatorPercent(1000, step=5, start=0, msg="%3.0f%%")
pi.logger.setLevel('INFO')
pi.show(0)
@ -923,7 +924,10 @@ def test_progress_percentage_sameline(capfd):
assert err == ' ' * 4 + '\r'
def test_progress_percentage_step(capfd):
def test_progress_percentage_step(capfd, monkeypatch):
# run the test as if it was in a 4x1 terminal
monkeypatch.setenv('COLUMNS', '4')
monkeypatch.setenv('LINES', '1')
pi = ProgressIndicatorPercent(100, step=2, start=0, msg="%3.0f%%")
pi.logger.setLevel('INFO')
pi.show()