Improved skipped decorator, now it tells you what was skipped even when not using nose.
This commit is contained in:
@@ -28,17 +28,19 @@ import unittest
|
|||||||
|
|
||||||
def skipped(func):
|
def skipped(func):
|
||||||
""" Decorator that marks a function as skipped. Uses nose's SkipTest exception
|
""" Decorator that marks a function as skipped. Uses nose's SkipTest exception
|
||||||
if installed, otherwise simply does a no-op test. Without nose, this will make
|
if installed. Without nose, this will count skipped tests as passing tests."""
|
||||||
skipped tests look like passing tests."""
|
|
||||||
try:
|
try:
|
||||||
from nose.plugins.skip import SkipTest
|
from nose.plugins.skip import SkipTest
|
||||||
def skipme(*a, **k):
|
def skipme(*a, **k):
|
||||||
raise SkipTest()
|
raise SkipTest()
|
||||||
skipme.__name__ == func.__name__
|
skipme.__name__ = func.__name__
|
||||||
return skipme
|
return skipme
|
||||||
except ImportError:
|
except ImportError:
|
||||||
# no nose, we'll just skip the test ourselves
|
# no nose, we'll just skip the test ourselves
|
||||||
return lambda *a, **k: None
|
def skipme(*a, **k):
|
||||||
|
print "Skipping", func.__name__
|
||||||
|
skipme.__name__ = func.__name__
|
||||||
|
return skipme
|
||||||
|
|
||||||
|
|
||||||
def skip_unless_requirement(requirement):
|
def skip_unless_requirement(requirement):
|
||||||
|
Reference in New Issue
Block a user