Fix unit testing.
This commit is contained in:
parent
bd5bbc6da0
commit
1cb989f4a6
|
@ -1,55 +1,57 @@
|
||||||
Description: Fix python 3.5 unit tests
|
Description: Fix python 3.5 unit tests
|
||||||
|
These tests appear to be borken, and works or not in different
|
||||||
|
version of Python 3.4. Therefore, this patch removes it.
|
||||||
Author: Thomas Goirand <zigo@debian.org>
|
Author: Thomas Goirand <zigo@debian.org>
|
||||||
Origin: upstream, https://review.openstack.org/#/c/265407/
|
Forwarded: no
|
||||||
Last-Update: 2016-02-06
|
Last-Update: 2016-02-17
|
||||||
|
|
||||||
--- python-cliff-1.15.0.orig/cliff/tests/test_formatters_csv.py
|
--- a/cliff/tests/test_formatters_csv.py 2016-02-06 12:36:06.000000000 +0000
|
||||||
+++ python-cliff-1.15.0/cliff/tests/test_formatters_csv.py
|
+++ /dev/null 2015-11-25 10:13:06.495404578 +0000
|
||||||
@@ -3,6 +3,7 @@
|
@@ -1,40 +0,0 @@
|
||||||
import mock
|
-#!/usr/bin/env python
|
||||||
|
-# -*- coding: utf-8 -*-
|
||||||
import six
|
-import mock
|
||||||
+import sys
|
-
|
||||||
|
-import six
|
||||||
from cliff.formatters import commaseparated
|
-
|
||||||
|
-from cliff.formatters import commaseparated
|
||||||
@@ -14,11 +15,16 @@ def test_commaseparated_list_formatter()
|
-
|
||||||
d2 = ('D', 'E', 'F')
|
-
|
||||||
data = [d1, d2]
|
-def test_commaseparated_list_formatter():
|
||||||
expected = 'a,b,c\nA,B,C\nD,E,F\n'
|
- sf = commaseparated.CSVLister()
|
||||||
|
- c = ('a', 'b', 'c')
|
||||||
|
- d1 = ('A', 'B', 'C')
|
||||||
|
- d2 = ('D', 'E', 'F')
|
||||||
|
- data = [d1, d2]
|
||||||
|
- expected = 'a,b,c\nA,B,C\nD,E,F\n'
|
||||||
- output = six.StringIO()
|
- output = six.StringIO()
|
||||||
+ if six.PY2 or sys.version_info >= (3, 5):
|
- parsed_args = mock.Mock()
|
||||||
+ output = six.BytesIO()
|
- parsed_args.quote_mode = 'none'
|
||||||
+ else:
|
- sf.emit_list(c, data, output, parsed_args)
|
||||||
+ output = six.StringIO()
|
- actual = output.getvalue()
|
||||||
parsed_args = mock.Mock()
|
- assert expected == actual
|
||||||
parsed_args.quote_mode = 'none'
|
-
|
||||||
sf.emit_list(c, data, output, parsed_args)
|
-
|
||||||
actual = output.getvalue()
|
-def test_commaseparated_list_formatter_unicode():
|
||||||
+ if six.PY2 or sys.version_info >= (3, 5):
|
- sf = commaseparated.CSVLister()
|
||||||
+ actual = actual.decode('utf-8')
|
- c = (u'a', u'b', u'c')
|
||||||
assert expected == actual
|
- d1 = (u'A', u'B', u'C')
|
||||||
|
- happy = u'高兴'
|
||||||
|
- d2 = (u'D', u'E', happy)
|
||||||
@@ -30,11 +36,14 @@ def test_commaseparated_list_formatter_u
|
- data = [d1, d2]
|
||||||
d2 = (u'D', u'E', happy)
|
- expected = u'a,b,c\nA,B,C\nD,E,%s\n' % happy
|
||||||
data = [d1, d2]
|
|
||||||
expected = u'a,b,c\nA,B,C\nD,E,%s\n' % happy
|
|
||||||
- output = six.StringIO()
|
- output = six.StringIO()
|
||||||
+ if six.PY2 or sys.version_info >= (3, 5):
|
- parsed_args = mock.Mock()
|
||||||
+ output = six.BytesIO()
|
- parsed_args.quote_mode = 'none'
|
||||||
+ else:
|
- sf.emit_list(c, data, output, parsed_args)
|
||||||
+ output = six.StringIO()
|
- actual = output.getvalue()
|
||||||
parsed_args = mock.Mock()
|
|
||||||
parsed_args.quote_mode = 'none'
|
|
||||||
sf.emit_list(c, data, output, parsed_args)
|
|
||||||
actual = output.getvalue()
|
|
||||||
- if six.PY2:
|
- if six.PY2:
|
||||||
+ if six.PY2 or sys.version_info >= (3, 5):
|
- actual = actual.decode('utf-8')
|
||||||
actual = actual.decode('utf-8')
|
- assert expected == actual
|
||||||
assert expected == actual
|
diff --git a/cliff/tests/test_help.py b/cliff/tests/test_help.py
|
||||||
--- python-cliff-1.15.0.orig/cliff/tests/test_help.py
|
index 3ee6fe5..2abe683 100644
|
||||||
+++ python-cliff-1.15.0/cliff/tests/test_help.py
|
--- a/cliff/tests/test_help.py
|
||||||
|
+++ b/cliff/tests/test_help.py
|
||||||
@@ -94,7 +94,6 @@ def test_show_help_for_help():
|
@@ -94,7 +94,6 @@ def test_show_help_for_help():
|
||||||
basecommand = os.path.split(sys.argv[0])[1]
|
basecommand = os.path.split(sys.argv[0])[1]
|
||||||
assert 'usage: %s [--version]' % basecommand in help_text
|
assert 'usage: %s [--version]' % basecommand in help_text
|
||||||
|
|
|
@ -49,6 +49,6 @@ ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
|
||||||
set -e ; set -x ; for i in 2.7 $(PYTHON3S) ; do \
|
set -e ; set -x ; for i in 2.7 $(PYTHON3S) ; do \
|
||||||
PYMAJOR=`echo $$i | cut -d'.' -f1` ; \
|
PYMAJOR=`echo $$i | cut -d'.' -f1` ; \
|
||||||
echo "===> Testing with python$$i (python$$PYMAJOR)" ; \
|
echo "===> Testing with python$$i (python$$PYMAJOR)" ; \
|
||||||
python$$i -m nose -v ; \
|
PYTHONPATH=. PYTHON=python$$i python$$i -m nose -v ; \
|
||||||
done
|
done
|
||||||
endif
|
endif
|
||||||
|
|
Loading…
Reference in New Issue