( *args, **kwargs )
| 757 | def decorator( test ): |
| 758 | @functools.wraps( test ) |
| 759 | def Wrapper( *args, **kwargs ): |
| 760 | try: |
| 761 | test( *args, **kwargs ) |
| 762 | except Exception as test_exception: |
| 763 | # Ensure that we failed for the right reason |
| 764 | test_exception_message = ToUnicode( test_exception ) |
| 765 | try: |
| 766 | for matcher in exception_matchers: |
| 767 | assert_that( test_exception_message, matcher ) |
| 768 | except AssertionError: |
| 769 | # Failed for the wrong reason! |
| 770 | import traceback |
| 771 | print( 'Test failed for the wrong reason: ' + traceback.format_exc() ) |
| 772 | # Real failure reason is the *original* exception, we're only trapping |
| 773 | # and ignoring the exception that is expected. |
| 774 | raise test_exception |
| 775 | |
| 776 | # Failed for the right reason |
| 777 | skip( reason ) |
| 778 | else: |
| 779 | raise AssertionError( f'Test was expected to fail: { reason }' ) |
| 780 | return Wrapper |
| 781 | |
| 782 | return decorator |
nothing calls this directly
no outgoing calls
no test coverage detected