def test_pager(): with TemporaryFile() as f: with patch.object(pager_mod, 'Popen', new=stored_popen(f)): pager('paging through cat', 'cat') f.seek(0) data = f.read() if not PY2: # pragma: Python 3 data = data.decode() expect(data) == 'paging through cat'
def test_disable_pager(capsys): pager('pager forcibly disabled', pager=None) assert capsys.readouterr()[0] == 'pager forcibly disabled\n'
def test_pager(monkeypatch, capfd): pager('paging through cat', pager='cat') assert capfd.readouterr()[0] == 'paging through cat'
def test_disable_pager(stdout): pager('pager forcibly disabled', None) expect(stdout.getvalue()) == 'pager forcibly disabled\n'
def test_default_less_config(): with TemporaryFile() as f: with patch.object(pager_mod, 'Popen', new=stored_popen(f)): with patch_env(clear=True): pager('pager forcibly disabled') expect(getenv('LESS')) == 'FRSX'