MCPcopy Create free account
hub / github.com/ycm-core/YouCompleteMe / Wrapper

Function Wrapper

python/ycm/tests/test_utils.py:759–779  ·  view source on GitHub ↗
( *args, **kwargs )

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected