mirror of https://github.com/dbcli/pgcli
Clean up and add behave logging (#956)
This commit is contained in:
parent
fcf0eb022e
commit
12ad10f697
|
@ -1,8 +1,16 @@
|
|||
Upcoming:
|
||||
=========
|
||||
|
||||
Bug fixes:
|
||||
----------
|
||||
* Fix for error listing databases (#951). (Thanks: `Irina Truong`_)
|
||||
|
||||
Internal:
|
||||
---------
|
||||
|
||||
* Clean up and add behave logging. (Thanks: `Dick Marinus`_)
|
||||
|
||||
|
||||
2.0.0:
|
||||
======
|
||||
|
||||
|
|
|
@ -4,17 +4,44 @@ from __future__ import unicode_literals
|
|||
import re
|
||||
import pexpect
|
||||
from pgcli.main import COLOR_CODE_REGEX
|
||||
import textwrap
|
||||
|
||||
try:
|
||||
from StringIO import StringIO
|
||||
except ImportError:
|
||||
from io import StringIO
|
||||
|
||||
|
||||
def expect_exact(context, expected, timeout):
|
||||
timedout = False
|
||||
try:
|
||||
context.cli.expect_exact(expected, timeout=timeout)
|
||||
except:
|
||||
except pexpect.exceptions.TIMEOUT:
|
||||
timedout = True
|
||||
if timedout:
|
||||
# Strip color codes out of the output.
|
||||
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))
|
||||
actual = re.sub(r'\x1b\[([0-9A-Za-z;?])+[m|K]?',
|
||||
'', context.cli.before)
|
||||
raise Exception(
|
||||
textwrap.dedent('''\
|
||||
Expected:
|
||||
---
|
||||
{0!r}
|
||||
---
|
||||
Actual:
|
||||
---
|
||||
{1!r}
|
||||
---
|
||||
Full log:
|
||||
---
|
||||
{2!r}
|
||||
---
|
||||
''').format(
|
||||
expected,
|
||||
actual,
|
||||
context.logfile.getvalue()
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def expect_pager(context, expected, timeout):
|
||||
|
|
Loading…
Reference in New Issue