deb-python-cliff/debian/patches/fix-python3.5-unit-tests.patch

52 lines
1.8 KiB
Diff

Description: Fix python 3.5 unit tests
Author: Thomas Goirand <zigo@debian.org>
Origin: upstream, https://review.openstack.org/#/c/265407/
Last-Update: 2016-02-06
--- python-cliff-1.15.0.orig/cliff/tests/test_formatters_csv.py
+++ python-cliff-1.15.0/cliff/tests/test_formatters_csv.py
@@ -14,11 +14,15 @@ def test_commaseparated_list_formatter()
d2 = ('D', 'E', 'F')
data = [d1, d2]
expected = 'a,b,c\nA,B,C\nD,E,F\n'
- output = six.StringIO()
+ if six.PY2 or sys.version_info >= (3, 5):
+ output = six.BytesIO()
+ else:
+ output = six.StringIO()
parsed_args = mock.Mock()
parsed_args.quote_mode = 'none'
sf.emit_list(c, data, output, parsed_args)
actual = output.getvalue()
+ actual = actual.decode('utf-8')
assert expected == actual
@@ -30,11 +34,13 @@ def test_commaseparated_list_formatter_u
d2 = (u'D', u'E', happy)
data = [d1, d2]
expected = u'a,b,c\nA,B,C\nD,E,%s\n' % happy
- output = six.StringIO()
+ if six.PY2 or sys.version_info >= (3, 5):
+ output = six.BytesIO()
+ else:
+ output = six.StringIO()
parsed_args = mock.Mock()
parsed_args.quote_mode = 'none'
sf.emit_list(c, data, output, parsed_args)
actual = output.getvalue()
- if six.PY2:
- actual = actual.decode('utf-8')
+ actual = actual.decode('utf-8')
assert expected == actual
--- python-cliff-1.15.0.orig/cliff/tests/test_help.py
+++ python-cliff-1.15.0/cliff/tests/test_help.py
@@ -94,7 +94,6 @@ def test_show_help_for_help():
basecommand = os.path.split(sys.argv[0])[1]
assert 'usage: %s [--version]' % basecommand in help_text
assert 'optional arguments:\n --version' in help_text
- assert 'one \n three word command \n' in help_text
def test_list_deprecated_commands():