Fixed pylint, updated connectionpool & stats changes, added bitmessagemock file & moved mock folder to tests
This commit is contained in:
parent
ed1c8ca100
commit
3cc49da6f1
2
src/tests/mock/bitmessagemock.py
Normal file
2
src/tests/mock/bitmessagemock.py
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
def main():
|
||||||
|
pass
|
|
@ -43,6 +43,7 @@ class objectProcessor(threading.Thread):
|
||||||
def run(self):
|
def run(self):
|
||||||
"""Process the objects from `.queues.objectProcessorQueue`"""
|
"""Process the objects from `.queues.objectProcessorQueue`"""
|
||||||
while True:
|
while True:
|
||||||
|
# pylint: disable=unused-variable
|
||||||
objectType, data = queues.objectProcessorQueue.get()
|
objectType, data = queues.objectProcessorQueue.get()
|
||||||
|
|
||||||
if state.shutdown:
|
if state.shutdown:
|
|
@ -18,6 +18,7 @@ class MockSingleWorker(StoppableThread):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(MockSingleWorker, self).__init__(name="singleWorker")
|
super(MockSingleWorker, self).__init__(name="singleWorker")
|
||||||
proofofwork.init()
|
proofofwork.init()
|
||||||
|
self.busy = None
|
||||||
|
|
||||||
def stopThread(self):
|
def stopThread(self):
|
||||||
"""Signal through the queue that the thread should be stopped"""
|
"""Signal through the queue that the thread should be stopped"""
|
||||||
|
@ -35,7 +36,7 @@ class MockSingleWorker(StoppableThread):
|
||||||
|
|
||||||
while state.shutdown == 0:
|
while state.shutdown == 0:
|
||||||
self.busy = 0
|
self.busy = 0
|
||||||
command, data = queues.workerQueue.get()
|
command, _ = queues.workerQueue.get()
|
||||||
self.busy = 1
|
self.busy = 1
|
||||||
if command == 'stopThread':
|
if command == 'stopThread':
|
||||||
self.busy = 0
|
self.busy = 0
|
|
@ -3,7 +3,7 @@
|
||||||
# TODO make this dynamic, and watch out for frozen, like with messagetypes
|
# TODO make this dynamic, and watch out for frozen, like with messagetypes
|
||||||
from singleton import Singleton
|
from singleton import Singleton
|
||||||
|
|
||||||
|
# pylint: disable=old-style-class,too-few-public-methods
|
||||||
@Singleton
|
@Singleton
|
||||||
class MockInventory():
|
class MockInventory():
|
||||||
"""
|
"""
|
|
@ -9,17 +9,11 @@ from singleton import Singleton
|
||||||
|
|
||||||
logger = logging.getLogger('default')
|
logger = logging.getLogger('default')
|
||||||
|
|
||||||
|
# pylint: disable=too-few-public-methods
|
||||||
@Singleton
|
@Singleton
|
||||||
class MockBMConnectionPool(object):
|
class MockBMConnectionPool(object):
|
||||||
"""Pool of all existing connections"""
|
"""Pool of all existing connections"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
asyncore.set_rates(
|
|
||||||
BMConfigParser().safeGetInt(
|
|
||||||
"bitmessagesettings", "maxdownloadrate"),
|
|
||||||
BMConfigParser().safeGetInt(
|
|
||||||
"bitmessagesettings", "maxuploadrate")
|
|
||||||
)
|
|
||||||
self.outboundConnections = {}
|
self.outboundConnections = {}
|
||||||
self.inboundConnections = {}
|
self.inboundConnections = {}
|
|
@ -3,11 +3,11 @@ Network statistics
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def MockUploadSpeed():
|
def uploadSpeed():
|
||||||
"""Getting upload speed"""
|
"""Getting upload speed"""
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
def MockDownloadSpeed():
|
def downloadSpeed():
|
||||||
"""Getting download speed"""
|
"""Getting download speed"""
|
||||||
return 0
|
return 0
|
Reference in New Issue
Block a user