summaryrefslogtreecommitdiffstats
path: root/tests/features/steps/wrappers.py
diff options
context:
space:
mode:
authorMax Rothman <max@collegevine.com>2018-05-15 13:42:21 -0400
committerMax Rothman <max@collegevine.com>2018-09-23 17:02:08 -0400
commit172c9cd271afe8fe415850b996da2e50ad3b4270 (patch)
tree2c8ae73eb5500e4f4d95d006981dd9267a5a86a1 /tests/features/steps/wrappers.py
parent7889b2838f8890122d0f9c4bc141e03cfc25d003 (diff)
Respect \pset pager on expected behavior
"\pset pager" has three possible values: "always", "on", and "off". pgcli previously treated all non-"off" values as "always". This change implements the expected behavior, which is to use the pager when the output is larger than the terminal height (See \pset pager in https://www.postgresql.org/docs/9.2/static/app-psql.html). Pgcli adds to this by also using the pager when the output is wider than the terminal width. Fixes #813
Diffstat (limited to 'tests/features/steps/wrappers.py')
-rw-r--r--tests/features/steps/wrappers.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/features/steps/wrappers.py b/tests/features/steps/wrappers.py
index de49cede..9a7f89da 100644
--- a/tests/features/steps/wrappers.py
+++ b/tests/features/steps/wrappers.py
@@ -3,6 +3,7 @@ from __future__ import unicode_literals
import re
import pexpect
+from pgcli.main import COLOR_CODE_REGEX
def expect_exact(context, expected, timeout):
@@ -10,7 +11,7 @@ def expect_exact(context, expected, timeout):
context.cli.expect_exact(expected, timeout=timeout)
except:
# Strip color codes out of the output.
- actual = re.sub(r'\x1b\[([0-9A-Za-z;?])+[m|K]?', '', context.cli.before)
+ actual = COLOR_CODE_REGEX.sub('', context.cli.before)
raise Exception('Expected:\n---\n{0!r}\n---\n\nActual:\n---\n{1!r}\n---'.format(
expected,
actual))