Show More
@@ -120,8 +120,7 b" skip_doctest = make_label_dec('skip_doctest'," | |||
|
120 | 120 | omit from testing, while preserving the docstring for introspection, help, |
|
121 | 121 | etc.""") |
|
122 | 122 | |
|
123 | ||
|
124 | def skip(func,msg=''): | |
|
123 | def skip(msg=''): | |
|
125 | 124 | """Decorator - mark a test function for skipping from test suite. |
|
126 | 125 | |
|
127 | 126 | :Parameters: |
@@ -134,13 +133,15 b" def skip(func,msg=''):" | |||
|
134 | 133 | """ |
|
135 | 134 | |
|
136 | 135 | import nose |
|
137 | ||
|
138 | def wrapper(*a,**k): | |
|
139 | if msg: out = '\n'+msg | |
|
140 | else: out = '' | |
|
141 | raise nose.SkipTest("Skipping test for function: %s%s" % | |
|
142 | (func.__name__,out)) | |
|
143 | ||
|
144 | return apply_wrapper(wrapper,func) | |
|
145 | 136 | |
|
137 | def inner(func): | |
|
138 | ||
|
139 | def wrapper(*a,**k): | |
|
140 | if msg: out = '\n'+msg | |
|
141 | else: out = '' | |
|
142 | raise nose.SkipTest("Skipping test for function: %s%s" % | |
|
143 | (func.__name__,out)) | |
|
144 | ||
|
145 | return apply_wrapper(wrapper,func) | |
|
146 | 146 | |
|
147 | return inner |
@@ -45,6 +45,11 b' def test_deliberately_broken():' | |||
|
45 | 45 | """A deliberately broken test - we want to skip this one.""" |
|
46 | 46 | 1/0 |
|
47 | 47 | |
|
48 | @dec.skip('foo') | |
|
49 | def test_deliberately_broken2(): | |
|
50 | """Another deliberately broken test - we want to skip this one.""" | |
|
51 | 1/0 | |
|
52 | ||
|
48 | 53 | |
|
49 | 54 | # Verify that we can correctly skip the doctest for a function at will, but |
|
50 | 55 | # that the docstring itself is NOT destroyed by the decorator. |
General Comments 0
You need to be logged in to leave comments.
Login now