Add support for conditional Skipping of unittests

Bug #814192 reported by Rohit Karajgi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Wishlist
Justin Shepherd

Bug Description

Currently the unit-test code does not support skipIf(condition). Only a nose.skip plugin is used for skipping tests. More flexibility is required for skipping tests.

We need to have this support for situations where a unit test needs to be skipped due to module errors. Eg. Skip a test if libvirt/libxml2 is not installed.
A decorator can be written for skipIf and provided to the test classes.

This support is available in the unittest2 library

Related branches

Rohit Karajgi (rohitk)
description: updated
Revision history for this message
Thierry Carrez (ttx) wrote :

This was tried by Brian Lamar in https://code.launchpad.net/~blamar/nova/libvirt-cleanup-branch/+merge/66064

See the last comment from Monty: unfortunately skipIf is throwing a SkipTest error, which breaks our test harness. So this needs some extra care. Note that we already do conditional skipping with skip_test... is there a specific feature missing there ?

Changed in nova:
status: New → Incomplete
Revision history for this message
Rohit Karajgi (rohitk) wrote :

Thanks ttx. There should be someway to work around that error, since skipIf() can be handy.

This bug is linked to Brian's blueprint. I too feel that moving to unittest2 is necessary for additional support of skipIf and more features.

Based on this, my branch (lp:~rohitkarajgi/nova/libvirt_unittests) should get merged only after Brian's libvirt_refactoring branch is merged, to incorporate usage of unittest2.skipIf().

Revision history for this message
Thierry Carrez (ttx) wrote :

Sure, don't hesitate to lend a hand to Brian on this one by suggesting a solution, since he is busy on other things and this blocks your branch as well...

Changed in nova:
importance: Undecided → Wishlist
status: Incomplete → Confirmed
Changed in nova:
assignee: nobody → Justin Shepherd (jshepher)
status: Confirmed → In Progress
Revision history for this message
Justin Shepherd (jshepher) wrote :

Merge-prop pending resolution to lp:818210, as without venv I can not run any tests to ensure everything is working.

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → diablo-4
Thierry Carrez (ttx)
Changed in nova:
milestone: diablo-4 → 2011.3
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.