(obj: object, name: str)
| 28 | |
| 29 | |
| 30 | def call_optional(obj: object, name: str) -> bool: |
| 31 | method = getattr(obj, name, None) |
| 32 | if method is None: |
| 33 | return False |
| 34 | is_fixture = getfixturemarker(method) is not None |
| 35 | if is_fixture: |
| 36 | return False |
| 37 | if not callable(method): |
| 38 | return False |
| 39 | # If there are any problems allow the exception to raise rather than |
| 40 | # silently ignoring it. |
| 41 | method() |
| 42 | return True |