Skip to content

Commit 23d7fd4

Browse files
committed
updated changes on bitmessagemock
1 parent 72171e7 commit 23d7fd4

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

src/tests/mock/bitmessagemock.py

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,36 @@
1+
from class_addressGenerator import FakeAddressGenerator
2+
from class_singleWorker import MockSingleWorker
3+
from class_objectProcessor import MockObjectProcessor
4+
from inventory import MockInventory
5+
6+
17
def main():
28
"""Mock main function"""
3-
pass
9+
def start(self):
10+
"""Start main application"""
11+
# pylint: disable=too-many-statements,too-many-branches,too-many-locals
12+
13+
config = BMConfigParser()
14+
daemon = config.safeGetBoolean('bitmessagesettings', 'daemon')
15+
16+
# Start the address generation thread
17+
addressGeneratorThread = addressGenerator()
18+
# close the main program even if there are threads left
19+
addressGeneratorThread.daemon = True
20+
addressGeneratorThread.start()
21+
22+
# Start the thread that calculates POWs
23+
singleWorkerThread = MockSingleWorker()
24+
# close the main program even if there are threads left
25+
singleWorkerThread.daemon = True
26+
singleWorkerThread.start()
27+
28+
# Start the thread that calculates POWs
29+
objectProcessorThread = MockObjectProcessor()
30+
# DON'T close the main program even the thread remains.
31+
# This thread checks the shutdown variable after processing
32+
# each object.
33+
objectProcessorThread.daemon = False
34+
objectProcessorThread.start()
35+
36+
MockInventory() # init

src/tests/mock/class_objectProcessor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
logger = logging.getLogger('default')
1616

1717

18-
class objectProcessor(threading.Thread):
18+
class MockObjectProcessor(threading.Thread):
1919
"""
2020
The objectProcessor thread, of which there is only one, receives network
2121
objects (msg, broadcast, pubkey, getpubkey) from the receiveDataThreads.

0 commit comments

Comments
 (0)