Show More
@@ -120,8 +120,7 b" skip_doctest = make_label_dec('skip_doctest'," | |||||
120 | omit from testing, while preserving the docstring for introspection, help, |
|
120 | omit from testing, while preserving the docstring for introspection, help, | |
121 | etc.""") |
|
121 | etc.""") | |
122 |
|
122 | |||
123 |
|
123 | def skip(msg=''): | ||
124 | def skip(func,msg=''): |
|
|||
125 | """Decorator - mark a test function for skipping from test suite. |
|
124 | """Decorator - mark a test function for skipping from test suite. | |
126 |
|
125 | |||
127 | :Parameters: |
|
126 | :Parameters: | |
@@ -135,6 +134,8 b" def skip(func,msg=''):" | |||||
135 |
|
134 | |||
136 | import nose |
|
135 | import nose | |
137 |
|
136 | |||
|
137 | def inner(func): | |||
|
138 | ||||
138 | def wrapper(*a,**k): |
|
139 | def wrapper(*a,**k): | |
139 | if msg: out = '\n'+msg |
|
140 | if msg: out = '\n'+msg | |
140 | else: out = '' |
|
141 | else: out = '' | |
@@ -143,4 +144,4 b" def skip(func,msg=''):" | |||||
143 |
|
144 | |||
144 | return apply_wrapper(wrapper,func) |
|
145 | return apply_wrapper(wrapper,func) | |
145 |
|
146 | |||
146 |
|
147 | return inner |
@@ -45,6 +45,11 b' def test_deliberately_broken():' | |||||
45 | """A deliberately broken test - we want to skip this one.""" |
|
45 | """A deliberately broken test - we want to skip this one.""" | |
46 | 1/0 |
|
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 | # Verify that we can correctly skip the doctest for a function at will, but |
|
54 | # Verify that we can correctly skip the doctest for a function at will, but | |
50 | # that the docstring itself is NOT destroyed by the decorator. |
|
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