Пример #1
0
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'
Пример #2
0
def test_disable_pager(capsys):
    pager('pager forcibly disabled', pager=None)
    assert capsys.readouterr()[0] == 'pager forcibly disabled\n'
Пример #3
0
def test_pager(monkeypatch, capfd):
    pager('paging through cat', pager='cat')
    assert capfd.readouterr()[0] == 'paging through cat'
Пример #4
0
def test_disable_pager(stdout):
    pager('pager forcibly disabled', None)
    expect(stdout.getvalue()) == 'pager forcibly disabled\n'
Пример #5
0
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'