SIENTIAPDE-1975: Sonar fixes in the NATS consumer tests
- One call per pytest.raises block (S5778): build the guarded start() before the block and nest the patch outside it. - The NATS callbacks stay async on purpose: nats-py rejects callbacks that are not coroutine functions. Comment it and assert it in the callback test, so nobody drops the async keyword to please S7503. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -94,6 +94,8 @@ class NatsWriteConsumer:
|
||||
f'{traceback.format_exc()}'
|
||||
)
|
||||
|
||||
# These stay async with nothing to await: nats-py rejects callbacks that are not
|
||||
# coroutine functions (InvalidCallbackTypeError on connect).
|
||||
async def _on_error(self, e: Exception) -> None:
|
||||
self.logger.warning(f'NATS error: {type(e).__name__} {e}')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user