mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-27 18:28:42 +00:00
use monkeypatch
This commit is contained in:
parent
76638d0562
commit
3896f26ab2
1 changed files with 8 additions and 4 deletions
|
@ -903,9 +903,10 @@ def test_yes_env_output(capfd, monkeypatch):
|
||||||
assert 'yes' in err
|
assert 'yes' in err
|
||||||
|
|
||||||
|
|
||||||
def test_progress_percentage_sameline(capfd):
|
def test_progress_percentage_sameline(capfd, monkeypatch):
|
||||||
os.environ['COLUMNS'] = '4'
|
# run the test as if it was in a 4x1 terminal
|
||||||
os.environ['LINES'] = '1'
|
monkeypatch.setenv('COLUMNS', '4')
|
||||||
|
monkeypatch.setenv('LINES', '1')
|
||||||
pi = ProgressIndicatorPercent(1000, step=5, start=0, msg="%3.0f%%")
|
pi = ProgressIndicatorPercent(1000, step=5, start=0, msg="%3.0f%%")
|
||||||
pi.logger.setLevel('INFO')
|
pi.logger.setLevel('INFO')
|
||||||
pi.show(0)
|
pi.show(0)
|
||||||
|
@ -923,7 +924,10 @@ def test_progress_percentage_sameline(capfd):
|
||||||
assert err == ' ' * 4 + '\r'
|
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 = ProgressIndicatorPercent(100, step=2, start=0, msg="%3.0f%%")
|
||||||
pi.logger.setLevel('INFO')
|
pi.logger.setLevel('INFO')
|
||||||
pi.show()
|
pi.show()
|
||||||
|
|
Loading…
Reference in a new issue