nose TestResult object is missing the addSkip method and addError method is invoked

Bug #1177608 reported by Nathan Biles on 2013-05-08
28
This bug affects 4 people
Affects Status Importance Assigned to Milestone
tempest
Medium
Ian Wienand

Bug Description

The tempest/tests/volume/admin/test_multi_backend.py test is not being skipped for me (it's failing
in the setup method) even though I have multi_backend_enabled = false in tempest.conf

Giulio Fidente (gfidente) wrote :

are you sure you have set the option under the [volume] section of the tempest.conf file?

Matt Riedemann (mriedem) wrote :

Yeah, the test result actually logs this too:

"Cinder multi-backend feature is not available"

We're just cloning tempest from github on the master branch for each run in a new VM and copying tempest/etc/tempest.conf.sample to tempest/etc/tempest.conf and then setting some values (like the credentials, images to use, flavors, etc).

Fails like this:

  File "/usr/lib/python2.6/site-packages/nose/suite.py", line 208, in run
    self.setUp()
  File "/usr/lib/python2.6/site-packages/nose/suite.py", line 291, in setUp
    self.setupContext(ancestor)
  File "/usr/lib/python2.6/site-packages/nose/suite.py", line 314, in setupContext
    try_run(context, names)
  File "/usr/lib/python2.6/site-packages/nose/util.py", line 469, in try_run
    return func()
  File "/usr/lib/python2.6/site-packages/testtools/testcase.py", line 780, in skip_wrapper
    raise TestCase.skipException(reason)
Cinder multi-backend feature is not available

It should be noted this is running on python 2.6. We upgrade testtools to the latest version for each run of Tempest.

Fix proposed to branch: master
Review: https://review.openstack.org/30760

Changed in tempest:
assignee: nobody → Giulio Fidente (gfidente)
status: New → In Progress
Changed in tempest:
importance: Undecided → Medium
Changed in tempest:
milestone: none → havana-2

Reviewed: https://review.openstack.org/30760
Committed: http://github.com/openstack/tempest/commit/f4fa894fba31cbfd6234bd8b37df2b0c126be748
Submitter: Jenkins
Branch: master

commit f4fa894fba31cbfd6234bd8b37df2b0c126be748
Author: Giulio Fidente <email address hidden>
Date: Tue May 28 18:48:03 2013 +0200

    Fixes the multi-backend skip bug and the cleanup steps

    The multi-backend test class and the tests within should now be
    skipped correctly also when running on python 2.6. Also fixes
    a cleanup problem occurring in case of error in setUpClass and
    speed things up by not creating the 2nd volume/type if backends
    have the same name (in which case only part of the tests can be
    executed).

    Change-Id: Ibeb961ea000bb1d1034f857a64552c7aa75ed4d5
    Fixes: bug #1177608

Changed in tempest:
status: In Progress → Fix Released

Now I'm seeing this:

 File "/usr/lib/python2.6/site-packages/nose/suite.py", line 208, in run
    self.setUp()
  File "/usr/lib/python2.6/site-packages/nose/suite.py", line 291, in setUp
    self.setupContext(ancestor)
  File "/usr/lib/python2.6/site-packages/nose/suite.py", line 314, in setupContext
    try_run(context, names)
  File "/usr/lib/python2.6/site-packages/nose/util.py", line 469, in try_run
    return func()
  File "/tmp/tempest/tempest/tempest/api/volume/admin/test_multi_backend.py", line 32, in setUpClass
    raise cls.skipException("Cinder multi-backend feature disabled")

Should that result in an error when running tempest?

Giulio Fidente (gfidente) wrote :

I managed to reproduce the error , thanks for pointing this out.

Changed in tempest:
status: Fix Released → In Progress
Giulio Fidente (gfidente) wrote :

I'm going to update the title, the bug seems related to how the skipException is catched in py26 and affects all the tests skips which use it (not just the multi_backend thing)

summary: - test_multi_backend.py not skipping properly
+ legacy TestResult object is missing the addSkip method and addError
+ method is invoked
Giulio Fidente (gfidente) wrote :

we skip using skipException from within the setUpClass

Robert Collins (lifeless) wrote :

sorry, I misunderstood the question. The issue is that nose is using the python standard library result object and not fixing it up to include addSkip.

summary: - legacy TestResult object is missing the addSkip method and addError
- method is invoked
+ nose TestResult object is missing the addSkip method and addError method
+ is invoked
Giulio Fidente (gfidente) wrote :

<lifeless> python 2.6 has no setUpClass.
<lifeless> testtools has no setUpClass
<lifeless> so the call stack is
<lifeless> nose
<lifeless> SomeClass.setUpClass
<lifeless> ... raise skipException
<lifeless> and unless skipException is an exception type nose expects to catch, nose will perceive this as an error.
<lifeless> so. I think this is the issue
<lifeless> https://github.com/nose-devs/nose/blob/master/nose/plugins/skip.py
<lifeless> see how it tries to import from unittest
<lifeless> in 2.7 nose has imported it from there
<lifeless> and so has testtools
<lifeless> so testtools' skipException type is the same type.
<lifeless> In 2.6, we have to make our own, and so does nose, so they are different, and what you're raising it doesn't know about.

Fix proposed to branch: master
Review: https://review.openstack.org/33769

Changed in tempest:
assignee: Giulio Fidente (gfidente) → Ian Wienand (iwienand)
Giulio Fidente (gfidente) wrote :

I think this has finally been fixed with the following: https://review.openstack.org/#/c/38284/

I'm moving the bug in FIXED state.

Changed in tempest:
status: In Progress → Fix Released
Matt Riedemann (mriedem) wrote :

Yup, confirmed this is fixed when running tempest on python 2.6 with the environment variable set to enable the monkey patch:

http://paste.openstack.org/show/44322/

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers