WIP: Added mock code #1883

Draft
kdcis wants to merge 10 commits from kdcis/mock-test into v0.6
9 changed files with 9 additions and 11 deletions
Showing only changes of commit 3cc49da6f1 - Show all commits

View File

@ -0,0 +1,2 @@
PeterSurda commented 2021-12-13 06:46:41 +01:00 (Migrated from github.com)
Review

here it can start launching the mock threads.

here it can start launching the mock threads.
PeterSurda commented 2021-12-13 06:46:41 +01:00 (Migrated from github.com)
Review

here it can start launching the mock threads.

here it can start launching the mock threads.
def main():
PeterSurda commented 2021-12-13 06:46:41 +01:00 (Migrated from github.com)
Review

here it can start launching the mock threads.

here it can start launching the mock threads.
pass
PeterSurda commented 2021-12-13 06:46:41 +01:00 (Migrated from github.com)
Review

here it can start launching the mock threads.

here it can start launching the mock threads.

View File

@ -43,6 +43,7 @@ class objectProcessor(threading.Thread):
PeterSurda commented 2021-12-14 08:45:27 +01:00 (Migrated from github.com)
Review

25 - 41 - remove

25 - 41 - remove
PeterSurda commented 2021-12-14 08:45:27 +01:00 (Migrated from github.com)
Review

25 - 41 - remove

25 - 41 - remove
def run(self):
"""Process the objects from `.queues.objectProcessorQueue`"""
while True:
# pylint: disable=unused-variable
PeterSurda commented 2021-12-14 08:45:27 +01:00 (Migrated from github.com)
Review

25 - 41 - remove

25 - 41 - remove
objectType, data = queues.objectProcessorQueue.get()
if state.shutdown:

View File

@ -18,6 +18,7 @@ class MockSingleWorker(StoppableThread):
def __init__(self):
super(MockSingleWorker, self).__init__(name="singleWorker")
proofofwork.init()
self.busy = None
def stopThread(self):
"""Signal through the queue that the thread should be stopped"""
@ -35,7 +36,7 @@ class MockSingleWorker(StoppableThread):
while state.shutdown == 0:
self.busy = 0
command, data = queues.workerQueue.get()
command, _ = queues.workerQueue.get()
self.busy = 1
if command == 'stopThread':
self.busy = 0

View File

@ -3,7 +3,7 @@
# TODO make this dynamic, and watch out for frozen, like with messagetypes
from singleton import Singleton
# pylint: disable=old-style-class,too-few-public-methods
@Singleton
class MockInventory():
"""

View File

@ -9,17 +9,11 @@ from singleton import Singleton
logger = logging.getLogger('default')
# pylint: disable=too-few-public-methods
@Singleton
class MockBMConnectionPool(object):
"""Pool of all existing connections"""
def __init__(self):
asyncore.set_rates(
BMConfigParser().safeGetInt(
"bitmessagesettings", "maxdownloadrate"),
BMConfigParser().safeGetInt(
"bitmessagesettings", "maxuploadrate")
)
self.outboundConnections = {}
self.inboundConnections = {}

View File

@ -3,11 +3,11 @@ Network statistics
"""
def MockUploadSpeed():
def uploadSpeed():
"""Getting upload speed"""
return 0
def MockDownloadSpeed():
def downloadSpeed():
"""Getting download speed"""
return 0