Conditionals were not actually runing the tests when they were supposed to. Renamed example testcases

This commit is contained in:
Justin Shepherd
2011-08-03 20:48:17 -05:00
parent 1cc00d6fb5
commit 9965cb4ca5
2 changed files with 5 additions and 3 deletions

View File

@@ -79,6 +79,7 @@ class skip_if(object):
"""Wrapped skipper function."""
if self.condition:
raise nose.SkipTest(self.message)
func(*args, **kw)
_skipper.__name__ = func.__name__
_skipper.__doc__ = func.__doc__
return _skipper
@@ -95,6 +96,7 @@ class skip_unless(object):
"""Wrapped skipper function."""
if not self.condition:
raise nose.SkipTest(self.message)
func(*args, **kw)
_skipper.__name__ = func.__name__
_skipper.__doc__ = func.__doc__
return _skipper

View File

@@ -21,13 +21,13 @@ from nova import test
class ExampleSkipTestCase(test.TestCase):
@test.skip_test("Example usage of @test.skip_test()")
def test_skip_test(self):
def test_skip_test_example(self):
self.fail("skip_test failed to work properly.")
@test.skip_if(True, "Example usage of @test.skip_if()")
def test_skip_if_env_user_exists(self):
def test_skip_if_example(self):
self.fail("skip_if failed to work properly.")
@test.skip_unless(False, "Example usage of @test.skip_unless()")
def test_skip_unless_env_foo_exists(self):
def test_skip_unless_example(self):
self.fail("skip_unless failed to work properly.")