| 1 |
from exc.test_failed import TestFailed |
| 2 |
from conf import hook |
| 3 |
|
| 4 |
""" Hook: SampleHook |
| 5 |
This a sample file for how a new hook should be defined. |
| 6 |
Any errors should always be reported by raising a TestFailed exception instead |
| 7 |
of returning a true or false value. |
| 8 |
""" |
| 9 |
|
| 10 |
|
| 11 |
@hook(alias='SampleHookAlias') |
| 12 |
class SampleHook: |
| 13 |
def __init__(self, sample_hook_arg): |
| 14 |
# do conf initialization here |
| 15 |
self.arg = sample_hook_arg |
| 16 |
|
| 17 |
def __call__(self, test_obj): |
| 18 |
# implement hook here |
| 19 |
# if you need the test case instance, refer to test_obj |
| 20 |
if False: |
| 21 |
raise TestFailed("Reason") |
| 22 |
pass |