Causes a test to exit with no valid result. By default, the no_result() method reports NO RESULT for the test and exits with a status of 2. If a condition argument is supplied, the test fails only if the condition is true.
(self=None, condition=True, function=None, skip=0)
| 131 | |
| 132 | |
| 133 | def no_result(self=None, condition=True, function=None, skip=0): |
| 134 | """Causes a test to exit with no valid result. |
| 135 | |
| 136 | By default, the no_result() method reports NO RESULT for the test and |
| 137 | exits with a status of 2. If a condition argument is supplied, the test |
| 138 | fails only if the condition is true. |
| 139 | |
| 140 | """ |
| 141 | if not condition: |
| 142 | return |
| 143 | if not function is None: |
| 144 | function() |
| 145 | of = "" |
| 146 | desc = "" |
| 147 | sep = " " |
| 148 | if not self is None: |
| 149 | if self.program: |
| 150 | of = " of " + self.program |
| 151 | sep = "\n\t" |
| 152 | if self.description: |
| 153 | desc = " [" + self.description + "]" |
| 154 | sep = "\n\t" |
| 155 | |
| 156 | at = caller(traceback.extract_stack(), skip) |
| 157 | sys.stderr.write("NO RESULT for test" + of + desc + sep + at) |
| 158 | sys.exit(2) |
| 159 | |
| 160 | |
| 161 | def pass_test(self=None, condition=True, function=None): |