Skip to content

Commit

Permalink
Fix wrong use of six.moves.queue.get()
Browse files Browse the repository at this point in the history
timeout is not the first positional argument.

Change-Id: Icd745514adc14730b9179fa7a6dd5c115f5e87a5
Closes-Bug: #1625604
  • Loading branch information
huihongxiao committed Sep 22, 2016
1 parent 86f7cfe commit a01ca10
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion neutron/agent/ovsdb/impl_idl.py
Expand Up @@ -64,7 +64,7 @@ def add(self, command):
def commit(self):
self.ovsdb_connection.queue_txn(self)
try:
result = self.results.get(self.timeout)
result = self.results.get(timeout=self.timeout)
except Queue.Empty:
raise api.TimeoutException(
_("Commands %(commands)s exceeded timeout %(timeout)d "
Expand Down
8 changes: 3 additions & 5 deletions neutron/tests/unit/agent/ovsdb/test_impl_idl.py
Expand Up @@ -13,7 +13,6 @@
# under the License.

import mock
from six.moves import queue
import testtools

from neutron.agent.ovsdb import api
Expand All @@ -23,10 +22,9 @@

class TransactionTestCase(base.BaseTestCase):
def test_commit_raises_exception_on_timeout(self):
with mock.patch.object(queue, 'Queue') as mock_queue:
transaction = impl_idl.NeutronOVSDBTransaction(mock.sentinel,
mock.Mock(), 0)
mock_queue.return_value.get.side_effect = queue.Empty
transaction = impl_idl.NeutronOVSDBTransaction(mock.sentinel,
mock.Mock(), 1)
with self.assert_max_execution_time(10):
with testtools.ExpectedException(api.TimeoutException):
transaction.commit()

Expand Down

0 comments on commit a01ca10

Please sign in to comment.