Merge "unit: fix ValueError on TransactionQueue init with py34"

This commit is contained in:
Jenkins 2016-05-26 11:43:55 +00:00 committed by Gerrit Code Review
commit 6a04f417ac
2 changed files with 9 additions and 2 deletions

View File

@ -29,8 +29,10 @@ class TransactionQueue(Queue.Queue, object):
def __init__(self, *args, **kwargs):
super(TransactionQueue, self).__init__(*args, **kwargs)
alertpipe = os.pipe()
self.alertin = os.fdopen(alertpipe[0], 'r', 0)
self.alertout = os.fdopen(alertpipe[1], 'w', 0)
# NOTE(ivasilevskaya) python 3 doesn't allow unbuffered I/O. Will get
# around this constraint by using binary mode.
self.alertin = os.fdopen(alertpipe[0], 'rb', 0)
self.alertout = os.fdopen(alertpipe[1], 'wb', 0)
def get_nowait(self, *args, **kwargs):
try:

View File

@ -57,3 +57,8 @@ class TestOVSNativeConnection(base.BaseTestCase):
@helpers.requires_py2
def test_start_with_table_name_list(self):
self._test_start(table_name_list=['fake-table1', 'fake-table2'])
def test_transaction_queue_init(self):
# a test to cover py34 failure during initialization (LP Bug #1580270)
# make sure no ValueError: can't have unbuffered text I/O is raised
connection.TransactionQueue()