← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1823278] [NEW] SynchronousThreadPoolExecutorFixture mock spec does not work

 

Public bug reported:

The fixture's fake submit() method returns a mocked future that is
intended to be a Mock with spec=futurist.Future but the speccing doesn't
work because the spec is passed a string when it needs to be a class or
an instance. Because of the bug, code like this:

  self.useFixture(fixtures.SynchronousThreadPoolExecutorFixture())
  executor = futurist.GreenThreadPoolExecutor()
  future = executor.submit(...)
  result = future.result()

raises the following error:

  AttributeError: Mock object has no attribute 'result'

The mock spec just needs to be changed from a string to a class or
instance.

** Affects: nova
     Importance: Low
     Assignee: melanie witt (melwitt)
         Status: In Progress


** Tags: testing

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1823278

Title:
  SynchronousThreadPoolExecutorFixture mock spec does not work

Status in OpenStack Compute (nova):
  In Progress

Bug description:
  The fixture's fake submit() method returns a mocked future that is
  intended to be a Mock with spec=futurist.Future but the speccing
  doesn't work because the spec is passed a string when it needs to be a
  class or an instance. Because of the bug, code like this:

    self.useFixture(fixtures.SynchronousThreadPoolExecutorFixture())
    executor = futurist.GreenThreadPoolExecutor()
    future = executor.submit(...)
    result = future.result()

  raises the following error:

    AttributeError: Mock object has no attribute 'result'

  The mock spec just needs to be changed from a string to a class or
  instance.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1823278/+subscriptions


Follow ups