This test checks the output based on Python's string representation of an array of two unicode strings. These strings have a "u" prefix in Python 2, but not Python 3. In Python 3, all strings are unicode.
Use sed on the output to strip the "u" from Python 2 output when checking for the expected result. Signed-off-by: Russell Bryant <russ...@ovn.org> --- tests/test-ovsdb.py | 2 +- tests/unixctl-py.at | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test-ovsdb.py b/tests/test-ovsdb.py index 9d18ec3..0f345c1 100644 --- a/tests/test-ovsdb.py +++ b/tests/test-ovsdb.py @@ -109,7 +109,7 @@ def do_parse_atoms(type_string, *atom_strings): atom = data.Atom.from_json(base, atom_json) print(ovs.json.to_string(atom.to_json())) except error.Error as e: - print(e.args[0].encode("utf8")) + print(e.args[0]) def do_parse_data(type_string, *data_strings): diff --git a/tests/unixctl-py.at b/tests/unixctl-py.at index ec029fc..9ba7023 100644 --- a/tests/unixctl-py.at +++ b/tests/unixctl-py.at @@ -114,15 +114,15 @@ AT_CHECK([APPCTL -t test-unixctl.py version], [0], [expout]) AT_CHECK([PYAPPCTL -t test-unixctl.py version], [0], [expout]) AT_CHECK([APPCTL -t test-unixctl.py echo robot ninja], [0], [stdout]) -AT_CHECK([cat stdout], [0], [dnl -[[u'robot', u'ninja']] +AT_CHECK([cat stdout | sed -e "s/u'/'/g"], [0], [dnl +[['robot', 'ninja']] ]) mv stdout expout AT_CHECK([PYAPPCTL -t test-unixctl.py echo robot ninja], [0], [expout]) AT_CHECK([APPCTL -t test-unixctl.py echo_error robot ninja], [2], [], [stderr]) -AT_CHECK([cat stderr], [0], [dnl -[[u'robot', u'ninja']] +AT_CHECK([cat stderr | sed -e "s/u'/'/g"], [0], [dnl +[['robot', 'ninja']] ovs-appctl: test-unixctl.py: server returned an error ]) sed 's/ovs-appctl/appctl.py/' stderr > experr -- 2.5.0 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev