summaryrefslogtreecommitdiff
path: root/tests/test_utils.py
diff options
context:
space:
mode:
authorArmin Ronacher <armin.ronacher@active-4.com>2014-07-08 16:10:50 +0200
committerArmin Ronacher <armin.ronacher@active-4.com>2014-07-08 16:10:50 +0200
commitb625654063f03936c65f33d1f5025376f57f4a06 (patch)
tree22caa7d16ae879fb26fe644d1ff2c38aea8b9388 /tests/test_utils.py
parent47f5663125beb7f03397959ad2d3d080fcd2bf8d (diff)
downloadclick-b625654063f03936c65f33d1f5025376f57f4a06.tar.gz
Fixed a regression for echo_via_pager on 3.x. This fixes #185
Diffstat (limited to 'tests/test_utils.py')
-rw-r--r--tests/test_utils.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_utils.py b/tests/test_utils.py
index f30b1ff..ed4083b 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -1,6 +1,9 @@
+import os
import sys
import click
+import click._termui_impl
+
def test_echo(runner):
with runner.isolation() as out:
@@ -111,3 +114,11 @@ def test_prompts(runner):
result = runner.invoke(test_no, input='n\n')
assert not result.exception
assert result.output == 'Foo [Y/n]: n\nno :(\n'
+
+
+def test_echo_via_pager(monkeypatch, capfd):
+ monkeypatch.setitem(os.environ, 'PAGER', 'cat')
+ monkeypatch.setattr(click._termui_impl, 'isatty', lambda x: True)
+ click.echo_via_pager('haha')
+ out, err = capfd.readouterr()
+ assert out == 'haha\n'