Commit 5b91bcef authored by Julien Muchembled's avatar Julien Muchembled

Merge "tests: fix LoggerThreadName class for recent Python"

parents c2b8dbf9 dbcc333d
...@@ -330,19 +330,22 @@ class NeoCTL(neo.neoctl.app.NeoCTL): ...@@ -330,19 +330,22 @@ class NeoCTL(neo.neoctl.app.NeoCTL):
lambda self, address: setattr(self, '_server', address)) lambda self, address: setattr(self, '_server', address))
class LoggerThreadName(object): class LoggerThreadName(str):
def __init__(self, default='TEST'): def __new__(cls, default='TEST'):
self.__default = default return str.__new__(cls, default)
def __getattr__(self, attr): def __getattribute__(self, attr):
return getattr(str(self), attr) return getattr(str(self), attr)
def __hash__(self):
return id(self)
def __str__(self): def __str__(self):
try: try:
return threading.currentThread().node_name return threading.currentThread().node_name
except AttributeError: except AttributeError:
return self.__default return str.__str__(self)
class Patch(object): class Patch(object):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment