Trap that pretends to be an app but raises an exception instead. This to protect from code that does not properly pass app instances, then falls back to the current_app.
| 21 | |
| 22 | |
| 23 | class Trap: |
| 24 | """Trap that pretends to be an app but raises an exception instead. |
| 25 | |
| 26 | This to protect from code that does not properly pass app instances, |
| 27 | then falls back to the current_app. |
| 28 | """ |
| 29 | |
| 30 | def __getattr__(self, name): |
| 31 | # Workaround to allow unittest.mock to patch this object |
| 32 | # in Python 3.8 and above. |
| 33 | if name == '_is_coroutine' or name == '__func__': |
| 34 | return None |
| 35 | print(name) |
| 36 | raise RuntimeError('Test depends on current_app') |
| 37 | |
| 38 | |
| 39 | class UnitLogging(symbol_by_name(Celery.log_cls)): |
no outgoing calls
searching dependent graphs…