Skip to content

Cannot repr redis object without host attribute #262

@pudo

Description

@pudo

This seems to be due to the lack of .host attribute on the fake redis object:

  File "/aleph/aleph/worker.py", line 77, in get_worker
    log.info("Listen: %s, stages: %s", kv, OPERATIONS)
  File "/usr/lib/python3.7/logging/__init__.py", line 1378, in info
    self._log(INFO, msg, args, **kwargs)
  File "/usr/lib/python3.7/logging/__init__.py", line 1514, in _log
    self.handle(record)
  File "/usr/lib/python3.7/logging/__init__.py", line 1524, in handle
    self.callHandlers(record)
  File "/usr/lib/python3.7/logging/__init__.py", line 1586, in callHandlers
    hdlr.handle(record)
  File "/usr/lib/python3.7/logging/__init__.py", line 894, in handle
    self.emit(record)
  File "/usr/local/lib/python3.7/dist-packages/nose/plugins/logcapture.py", line 82, in emit
    self.buffer.append(self.format(record))
  File "/usr/lib/python3.7/logging/__init__.py", line 869, in format
    return fmt.format(record)
  File "/usr/lib/python3.7/logging/__init__.py", line 608, in format
    record.message = record.getMessage()
  File "/usr/lib/python3.7/logging/__init__.py", line 369, in getMessage
    msg = msg % self.args
  File "/usr/local/lib/python3.7/dist-packages/werkzeug/local.py", line 367, in <lambda>
    __str__ = lambda x: str(x._get_current_object())
  File "/usr/local/lib/python3.7/dist-packages/redis/client.py", line 747, in __repr__
    return "%s<%s>" % (type(self).__name__, repr(self.connection_pool))
  File "/usr/local/lib/python3.7/dist-packages/redis/connection.py", line 1100, in __repr__
    repr(self.connection_class(**self.connection_kwargs)),
  File "/usr/local/lib/python3.7/dist-packages/redis/connection.py", line 522, in __repr__
    repr_args = ','.join(['%s=%s' % (k, v) for k, v in self.repr_pieces()])
  File "/usr/local/lib/python3.7/dist-packages/redis/connection.py", line 527, in repr_pieces
    ('host', self.host),
AttributeError: 'FakeConnection' object has no attribute 'host'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions