Skip to content

Commit

Permalink
Merge pull request #1152 from hroncok/patch-1
Browse files Browse the repository at this point in the history
Tests: monkeypatch shutil.get_terminal_size properly
  • Loading branch information
amjith authored Mar 29, 2024
2 parents 11dfb08 + e1ae26d commit fa4e3db
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions test/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,19 +254,15 @@ def test_conditional_pager(monkeypatch):
SPECIAL_COMMANDS['pager'].handler('')


def test_reserved_space_is_integer():
def test_reserved_space_is_integer(monkeypatch):
"""Make sure that reserved space is returned as an integer."""
def stub_terminal_size():
return (5, 5)

old_func = shutil.get_terminal_size

shutil.get_terminal_size = stub_terminal_size
monkeypatch.setattr(shutil, 'get_terminal_size', stub_terminal_size)
mycli = MyCli()
assert isinstance(mycli.get_reserved_space(), int)

shutil.get_terminal_size = old_func


def test_list_dsn():
runner = CliRunner()
Expand Down

0 comments on commit fa4e3db

Please sign in to comment.