From 0ae3108211b4757cd522b0b044b8333fb7811b8a Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Wed, 11 Nov 2015 13:59:22 +0100 Subject: [PATCH] Make sure we return unicode strings for process output Process output is supposed to be represented with lines, so we should put Python strings in the queue (not bytes). Just in case, we do it only for Python 3 environment. To fix that, we reuse code from utils.execute() linux/windows implementations. This fixes the TestAsyncProcess.test_async_process_respawns functional test for Python 3 environment. Related-Bug: #1515118 Change-Id: I9efec2290003add44909aab33a0026372a580016 --- neutron/tests/common/helpers.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/neutron/tests/common/helpers.py b/neutron/tests/common/helpers.py index 484c0216..b4178253 100644 --- a/neutron/tests/common/helpers.py +++ b/neutron/tests/common/helpers.py @@ -16,6 +16,8 @@ import datetime import os from oslo_utils import timeutils +import six +import testtools import neutron from neutron.common import constants @@ -153,3 +155,11 @@ def register_ovs_agent(host=HOST, agent_type=constants.AGENT_TYPE_OVS, tunneling_ip, interface_mappings, l2pop_network_types) return _register_agent(agent) + + +def requires_py2(testcase): + return testtools.skipUnless(six.PY2, "requires python 2.x")(testcase) + + +def requires_py3(testcase): + return testtools.skipUnless(six.PY3, "requires python 3.x")(testcase)