Repository: Naruno/Naruno (language: python)

Issue:
Making profilling



Discussion / hints:

Fix patch:
diff --git a/.gitignore b/.gitignore
index dd46ecb3..98c6ba0a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,8 @@
+#prof files
+naruno/prof/*
+prof/*
+*.prof
+
 #backups
 naruno/backups/*
 


Test patch:
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index eff158d3..9f9b66cd 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -87,13 +87,19 @@ jobs:
         pip install -r requirements/tests.txt
     - name: Test with pytest
       run: |
-        pytest tests/unit_tests -v
+        pytest tests/unit_tests -v --profile
     - name: Archive logs
       uses: actions/upload-artifact@v3
       with:
         name: log-report-unit-test-ubuntu-latest
         path: naruno/logs/*.log      
-  
+
+    - name: Archive Profile
+      uses: actions/upload-artifact@v3
+      with:
+        name: profile-report-unit-test-ubuntu-latest
+        path: prof/*
+      
   unit-test-macos-latest:
     needs: lint_with_flake8
 
@@ -123,12 +129,17 @@ jobs:
         pip install -r requirements/tests.txt
     - name: Test with pytest
       run: |
-        pytest tests/unit_tests -v
+        pytest tests/unit_tests -v --profile
     - name: Archive logs
       uses: actions/upload-artifact@v3
       with:
         name: log-report-unit-test-macos-latest
-        path: naruno/logs/*.log           
+        path: naruno/logs/*.log 
+    - name: Archive Profile
+      uses: actions/upload-artifact@v3
+      with:
+        name: profile-report-unit-test-macos-latest
+        path: prof/*                   
   unit-test-windows-latest:
     needs: lint_with_flake8
 
@@ -158,13 +169,20 @@ jobs:
         pip install -r requirements/tests.txt
     - name: Test with pytest
       run: |
-        pytest tests/unit_tests -v
+        pytest tests/unit_tests -v --profile
     - name: Archive logs
       uses: actions/upload-artifact@v3
       with:
         name: log-report-unit-test-windows-latest
         path: naruno/logs/*.log           
 
+    - name: Archive Profile
+      uses: actions/upload-artifact@v3
+      with:
+        name: profile-report-unit-test-windows-latest
+        path: prof/*    
+ 
+
   functional-test-local-ubuntu-latest:
     needs: [lint_with_flake8, unit-test-ubuntu-latest, unit-test-macos-latest, unit-test-windows-latest]
     runs-on: ubuntu-latest
diff --git a/pytest.ini b/pytest.ini
index 93e1db96..1572e099 100644
--- a/pytest.ini
+++ b/pytest.ini
@@ -1,2 +1,3 @@
 [pytest]
 norecursedirs = functional_test
+pytest_plugins = ['pytest_profiling']
diff --git a/requirements/tests.txt b/requirements/tests.txt
index 50fefbed..33ff1778 100644
--- a/requirements/tests.txt
+++ b/requirements/tests.txt
@@ -1,4 +1,5 @@
 requests==2.28.0
 pytest==7.1.2
+pytest_profiling==1.7.0
 speed_calculator==0.4.1
 decentra_network_api==0.31.1
diff --git a/setups/tests/setup.py b/setups/tests/setup.py
index d8483e6b..a9c39215 100644
--- a/setups/tests/setup.py
+++ b/setups/tests/setup.py
@@ -17,6 +17,7 @@
     install_requires="""
 requests==2.28.2
 pytest==7.1.2
+pytest_profiling==1.7.0
 speed_calculator==0.4.1
 naruno_api==0.57.3
 """,
diff --git a/tests/unit_tests/test_accounts.py b/tests/unit_tests/test_accounts.py
index 186081af..3424aa00 100644
--- a/tests/unit_tests/test_accounts.py
+++ b/tests/unit_tests/test_accounts.py
@@ -301,4 +301,7 @@ def test_commanders(self):
         self.assertEqual(GetCommander(), backup_commanders)
 
 
+backup = sys.argv
+sys.argv = [sys.argv[0]]
 unittest.main(exit=False)
+sys.argv = backup
diff --git a/tests/unit_tests/test_api.py b/tests/unit_tests/test_api.py
index e2768cdb..462e39c9 100644
--- a/tests/unit_tests/test_api.py
+++ b/tests/unit_tests/test_api.py
@@ -1136,4 +1136,7 @@ def test_sequance_number_page(self):
         self.assertEqual(the_balance_int, 1)
 
 
+backup = sys.argv
+sys.argv = [sys.argv[0]]
 unittest.main(exit=False)
+sys.argv = backup
diff --git a/tests/unit_tests/test_apps.py b/tests/unit_tests/test_apps.py
index 7b744a0d..4112f5c0 100644
--- a/tests/unit_tests/test_apps.py
+++ b/tests/unit_tests/test_apps.py
@@ -995,4 +995,7 @@ def test_send_splitter(self):
         )
 
 
+backup = sys.argv
+sys.argv = [sys.argv[0]]
 unittest.main(exit=False)
+sys.argv = backup
diff --git a/tests/unit_tests/test_blockchain.py b/tests/unit_tests/test_blockchain.py
index e49e4676..7048db3e 100644
--- a/tests/unit_tests/test_blockchain.py
+++ b/tests/unit_tests/test_blockchain.py
@@ -1334,4 +1334,7 @@ def test_SaveBlock_GetBlock_validating_vs_sequance_number_priority(self):
         self.assertEqual(block_2.dump_json(), block_3.dump_json())
 
 
+backup = sys.argv
+sys.argv = [sys.argv[0]]
 unittest.main(exit=False)
+sys.argv = backup
diff --git a/tests/unit_tests/test_config.py b/tests/unit_tests/test_config.py
index 7ddeb0ef..237f983a 100644
--- a/tests/unit_tests/test_config.py
+++ b/tests/unit_tests/test_config.py
@@ -6,11 +6,12 @@
 # file, You can obtain one at https://mozilla.org/MPL/2.0/.
 import os
 import sys
+
 sys.path.append(os.path.join(os.path.dirname(__file__), "..", ".."))
 import unittest
 
-from naruno.lib.config_system import get_config
 from naruno.lib.clean_up import CleanUp_tests
+from naruno.lib.config_system import get_config
 
 
 class Test_Config(unittest.TestCase):
@@ -34,4 +35,7 @@ def test_config_by_getting_and_saving_main_folder_config(self):
         self.assertEqual(finded_true_folder, True, "A problem on the config.")
 
 
+backup = sys.argv
+sys.argv = [sys.argv[0]]
 unittest.main(exit=False)
+sys.argv = backup
diff --git a/tests/unit_tests/test_consensus.py b/tests/unit_tests/test_consensus.py
index 9c176bac..62195796 100644
--- a/tests/unit_tests/test_consensus.py
+++ b/tests/unit_tests/test_consensus.py
@@ -3214,4 +3214,7 @@ def test_sync_send_transaction_exception_pending(self):
         )
 
 
+backup = sys.argv
+sys.argv = [sys.argv[0]]
 unittest.main(exit=False)
+sys.argv = backup
diff --git a/tests/unit_tests/test_lib.py b/tests/unit_tests/test_lib.py
index ced317a3..14520190 100644
--- a/tests/unit_tests/test_lib.py
+++ b/tests/unit_tests/test_lib.py
@@ -960,4 +960,7 @@ def test_logs(self):
         self.assertEqual("tedsadast" in content, True)
 
 
+backup = sys.argv
+sys.argv = [sys.argv[0]]
 unittest.main(exit=False)
+sys.argv = backup
diff --git a/tests/unit_tests/test_node.py b/tests/unit_tests/test_node.py
index 3c6b5578..c8686b62 100644
--- a/tests/unit_tests/test_node.py
+++ b/tests/unit_tests/test_node.py
@@ -17,14 +17,15 @@
 from naruno.accounts.get_accounts import GetAccounts
 from naruno.blockchain.block.block_main import Block
 from naruno.blockchain.block.blocks_hash import (GetBlockshash,
-                                                           GetBlockshash_part)
+                                                 GetBlockshash_part)
 from naruno.blockchain.block.get_block import GetBlock
 from naruno.blockchain.block.save_block import SaveBlock
-from naruno.config import (
-    CONNECTED_NODES_PATH, LOADING_ACCOUNTS_PATH, LOADING_BLOCK_PATH,
-    LOADING_BLOCKSHASH_PART_PATH, LOADING_BLOCKSHASH_PATH,
-    PENDING_TRANSACTIONS_PATH, TEMP_ACCOUNTS_PATH, TEMP_BLOCK_PATH,
-    TEMP_BLOCKSHASH_PART_PATH, TEMP_BLOCKSHASH_PATH, UNL_NODES_PATH)
+from naruno.config import (CONNECTED_NODES_PATH, LOADING_ACCOUNTS_PATH,
+                           LOADING_BLOCK_PATH, LOADING_BLOCKSHASH_PART_PATH,
+                           LOADING_BLOCKSHASH_PATH, PENDING_TRANSACTIONS_PATH,
+                           TEMP_ACCOUNTS_PATH, TEMP_BLOCK_PATH,
+                           TEMP_BLOCKSHASH_PART_PATH, TEMP_BLOCKSHASH_PATH,
+                           UNL_NODES_PATH)
 from naruno.consensus.finished.finished_main import finished_main
 from naruno.lib.clean_up import CleanUp_tests
 from naruno.lib.config_system import get_config
@@ -266,7 +267,6 @@ def test_false_message_type_not_true_timestamp(self):
         self.assertEqual(len(self.node_1.messages), first_message_len)
 
     def test_node_by_connection_saving_and_unl_nodes_system(self):
-
         connection_closing_deleting = True
         finded_node = False
         in_unl_list = False
@@ -314,7 +314,7 @@ def test_GetCandidateBlocks(self):
             "transaction_time": 1656764224,
         }
         the_transaction = Transaction.load_json(the_transaction_json)
-        the_block.validating_list = [the_transaction] 
+        the_block.validating_list = [the_transaction]
         client_1 = self.node_2.clients[1]
         client_2 = self.node_2.clients[0]
         client_2.candidate_block = None
@@ -324,7 +324,7 @@ def test_GetCandidateBlocks(self):
         client_1.candidate_block = None
         client_1.candidate_block_history = None
         client_1.candidate_block_hash = None
-        client_1.candidate_block_hash_history = None         
+        client_1.candidate_block_hash_history = None
         value_1 = {
             "action":
             "myblock",
@@ -342,7 +342,8 @@ def test_GetCandidateBlocks(self):
             "transaction": [],
             "sequence_number":
             0,
-            "hash": None,
+            "hash":
+            None,
             "id":
             "MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEExVJT06DcQ5LoxjXcj2bXrqwWbJoz+/zoSH9drpQ71i/BjjqnUg/E9k7qkUy/+QK3AENc1Gx+eBQ91Y7xlfG7w==",
             "signature":
@@ -354,22 +355,34 @@ def test_GetCandidateBlocks(self):
             "transaction": [],
             "sequence_number":
             0,
-            "hash": "None",
+            "hash":
+            "None",
             "id":
             "MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEExVJT06DcQ5LoxjXcj2bXrqwWbJoz+/zoSH9drpQ71i/BjjqnUg/E9k7qkUy/+QK3AENc1Gx+eBQ91Y7xlfG7w==",
             "signature":
             "MEUCIQDw33eHJvpfmShxv+CPYNnVa1XAg216teeHrsql78B6EwIgHk2JFQ/+JeqTO70yLFK8wYyxIN5qmvPOy+mdlbqNCuk=",
-        }             
+        }
         client_2.candidate_block = value_1
         client_2.candidate_block_hash = value_3
         client_1.candidate_block = value_1
         client_1.candidate_block_hash = value_2
         result = GetCandidateBlocks(block=the_block)
-        result.candidate_blocks[1]["transaction"][0] = result.candidate_blocks[1]["transaction"][0].dump_json()
-        self.assertEqual(result.candidate_blocks, [value_1, {'action': 'myblock', 'transaction': [the_transaction.dump_json()], 'signature': 'self', 'sequence_number': 0}])
+        result.candidate_blocks[1]["transaction"][0] = result.candidate_blocks[
+            1]["transaction"][0].dump_json()
+        self.assertEqual(
+            result.candidate_blocks,
+            [
+                value_1,
+                {
+                    "action": "myblock",
+                    "transaction": [the_transaction.dump_json()],
+                    "signature": "self",
+                    "sequence_number": 0,
+                },
+            ],
+        )
         self.assertEqual(result.candidate_block_hashes, [value_3])
 
-
     def test_GetCandidateBlocks_different_squance_number(self):
         self.maxDiff = None
         the_block = Block("Onur")
@@ -383,7 +396,7 @@ def test_GetCandidateBlocks_different_squance_number(self):
         client_1.candidate_block = None
         client_1.candidate_block_history = None
         client_1.candidate_block_hash = None
-        client_1.candidate_block_hash_history = None        
+        client_1.candidate_block_hash_history = None
         value_1 = {
             "action":
             "myblock",
@@ -416,14 +429,15 @@ def test_GetCandidateBlocks_different_squance_number(self):
             "MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEExVJT06DcQ5LoxjXcj2bXrqwWbJoz+/zoSH9drpQ71i/BjjqnUg/E9k7qkUy/+QK3AENc1Gx+eBQ91Y7xlfG7w==",
             "signature":
             "MEUCIQDw33eHJvpfmShxv+CPYNnVa1XAg216teeHrsql78B6EwIgHk2JFQ/+JeqTO70yLFK8wYyxIN5qmvPOy+mdlbqNCuk=",
-        }                 
+        }
         value_2 = {
             "action":
             "myblock",
             "transaction": [],
             "sequence_number":
             2,
-            "hash": None,
+            "hash":
+            None,
             "id":
             "MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEExVJT06DcQ5LoxjXcj2bXrqwWbJoz+/zoSH9drpQ71i/BjjqnUg/E9k7qkUy/+QK3AENc1Gx+eBQ91Y7xlfG7w==",
             "signature":
@@ -435,7 +449,8 @@ def test_GetCandidateBlocks_different_squance_number(self):
             "transaction": [],
             "sequence_number":
             0,
-            "hash": None,
+            "hash":
+            None,
             "id":
             "MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEExVJT06DcQ5LoxjXcj2bXrqwWbJoz+/zoSH9drpQ71i/BjjqnUg/E9k7qkUy/+QK3AENc1Gx+eBQ91Y7xlfG7w==",
             "signature":
@@ -447,48 +462,52 @@ def test_GetCandidateBlocks_different_squance_number(self):
             "transaction": [],
             "sequence_number":
             1,
-            "hash": None,
+            "hash":
+            None,
             "id":
             "MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEExVJT06DcQ5LoxjXcj2bXrqwWbJoz+/zoSH9drpQ71i/BjjqnUg/E9k7qkUy/+QK3AENc1Gx+eBQ91Y7xlfG7w==",
             "signature":
             "MEUCIQDw33eHJvpfmShxv+CPYNnVa1XAg216teeHrsql78B6EwIgHk2JFQ/+JeqTO70yLFK8wYyxIN5qmvPOy+mdlbqNCuk=",
-        }                 
+        }
         value_3 = {
             "action":
             "myblock",
             "transaction": [],
             "sequence_number":
             2,
-            "hash": "None",
+            "hash":
+            "None",
             "id":
             "MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEExVJT06DcQ5LoxjXcj2bXrqwWbJoz+/zoSH9drpQ71i/BjjqnUg/E9k7qkUy/+QK3AENc1Gx+eBQ91Y7xlfG7w==",
             "signature":
             "MEUCIQDw33eHJvpfmShxv+CPYNnVa1XAg216teeHrsql78B6EwIgHk2JFQ/+JeqTO70yLFK8wYyxIN5qmvPOy+mdlbqNCuk=",
-        }  
+        }
         value_3_old = {
             "action":
             "myblock",
             "transaction": [],
             "sequence_number":
             0,
-            "hash": "None",
+            "hash":
+            "None",
             "id":
             "MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEExVJT06DcQ5LoxjXcj2bXrqwWbJoz+/zoSH9drpQ71i/BjjqnUg/E9k7qkUy/+QK3AENc1Gx+eBQ91Y7xlfG7w==",
             "signature":
             "MEUCIQDw33eHJvpfmShxv+CPYNnVa1XAg216teeHrsql78B6EwIgHk2JFQ/+JeqTO70yLFK8wYyxIN5qmvPOy+mdlbqNCuk=",
-        }    
+        }
         value_3_old_1 = {
             "action":
             "myblock",
             "transaction": [],
             "sequence_number":
             1,
-            "hash": "None",
+            "hash":
+            "None",
             "id":
             "MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEExVJT06DcQ5LoxjXcj2bXrqwWbJoz+/zoSH9drpQ71i/BjjqnUg/E9k7qkUy/+QK3AENc1Gx+eBQ91Y7xlfG7w==",
             "signature":
             "MEUCIQDw33eHJvpfmShxv+CPYNnVa1XAg216teeHrsql78B6EwIgHk2JFQ/+JeqTO70yLFK8wYyxIN5qmvPOy+mdlbqNCuk=",
-        }                         
+        }
         client_2.candidate_block = value_1
         client_2.candidate_block_history = [value_1_old, value_1_old_1]
         client_2.candidate_block_hash = value_3
@@ -499,12 +518,34 @@ def test_GetCandidateBlocks_different_squance_number(self):
         client_1.candidate_block_hash_history = [value_2_old, value_2_old_1]
         result = GetCandidateBlocks(block=the_block)
         print(result.candidate_blocks)
-        self.assertEqual(result.candidate_blocks, [value_1_old, {'action': 'myblock', 'transaction': [], 'signature': 'self', 'sequence_number': 0}])
+        self.assertEqual(
+            result.candidate_blocks,
+            [
+                value_1_old,
+                {
+                    "action": "myblock",
+                    "transaction": [],
+                    "signature": "self",
+                    "sequence_number": 0,
+                },
+            ],
+        )
         self.assertEqual(result.candidate_block_hashes, [value_3_old])
 
         the_block.sequence_number = 1
         result = GetCandidateBlocks(block=the_block)
-        self.assertEqual(result.candidate_blocks, [value_1_old_1, {'action': 'myblock', 'transaction': [], 'signature': 'self', 'sequence_number': 1}])
+        self.assertEqual(
+            result.candidate_blocks,
+            [
+                value_1_old_1,
+                {
+                    "action": "myblock",
+                    "transaction": [],
+                    "signature": "self",
+                    "sequence_number": 1,
+                },
+            ],
+        )
         self.assertEqual(result.candidate_block_hashes, [value_3_old_1])
 
     def test_send_data_all(self):
@@ -1303,12 +1344,11 @@ def test_get_unl_nodes_not_exist(self):
         self.assertEqual(
             Unl.get_unl_nodes(custom_UNL_NODES_PATH=custom_UNL_NODES_PATH), {})
 
-
     def test_send_my_block_get_candidate_block_multiple(self):
         self.node_1.clients[0].candidate_block = None
         self.node_1.clients[0].candidate_block_history = []
         self.node_2.clients[0].candidate_block = None
-        self.node_2.clients[0].candidate_block_history = []        
+        self.node_2.clients[0].candidate_block_history = []
         self.maxDiff = None
         CleanUp_tests()
 
@@ -1316,65 +1356,61 @@ def test_send_my_block_get_candidate_block_multiple(self):
         self.node_0.send_my_block(the_block)
         time.sleep(2)
 
-        self.assertEqual(self.node_1.clients[0].candidate_block["sequence_number"],
-                         0)
-        self.assertEqual(self.node_2.clients[0].candidate_block["sequence_number"],
-                         0)
+        self.assertEqual(
+            self.node_1.clients[0].candidate_block["sequence_number"], 0)
+        self.assertEqual(
+            self.node_2.clients[0].candidate_block["sequence_number"], 0)
 
-        self.assertEqual(self.node_1.clients[0].candidate_block_history,
-                         [])
-        self.assertEqual(self.node_2.clients[0].candidate_block_history,
-                         [])
+        self.assertEqual(self.node_1.clients[0].candidate_block_history, [])
+        self.assertEqual(self.node_2.clients[0].candidate_block_history, [])
 
         the_block.sequence_number = 1
         self.node_0.send_my_block(the_block)
         time.sleep(2)
 
-        self.assertEqual(self.node_1.clients[0].candidate_block["sequence_number"],
-                         1)
-        self.assertEqual(self.node_2.clients[0].candidate_block["sequence_number"],
-                         1)                      
-        self.assertNotEqual(self.node_1.clients[0].candidate_block_history,
-                         [])
+        self.assertEqual(
+            self.node_1.clients[0].candidate_block["sequence_number"], 1)
+        self.assertEqual(
+            self.node_2.clients[0].candidate_block["sequence_number"], 1)
+        self.assertNotEqual(self.node_1.clients[0].candidate_block_history, [])
         self.assertEqual(len(self.node_1.clients[0].candidate_block_history),
                          1)
-        self.assertEqual(self.node_1.clients[0].candidate_block_history[0]["sequence_number"],
-                         0)                                              
-        self.assertNotEqual(self.node_2.clients[0].candidate_block_history,
-                         [])
+        self.assertEqual(
+            self.node_1.clients[0].candidate_block_history[0]
+            ["sequence_number"], 0)
+        self.assertNotEqual(self.node_2.clients[0].candidate_block_history, [])
         self.assertEqual(len(self.node_2.clients[0].candidate_block_history),
-                         1)  
-        self.assertEqual(self.node_2.clients[0].candidate_block_history[0]["sequence_number"],
-                         0)    
-
-
-
+                         1)
+        self.assertEqual(
+            self.node_2.clients[0].candidate_block_history[0]
+            ["sequence_number"], 0)
 
         the_block.sequence_number = 2
         self.node_0.send_my_block(the_block)
         time.sleep(2)
 
-        self.assertEqual(self.node_1.clients[0].candidate_block["sequence_number"],
-                         2)
-        self.assertEqual(self.node_2.clients[0].candidate_block["sequence_number"],
-                         2)                      
-        self.assertNotEqual(self.node_1.clients[0].candidate_block_history,
-                         [])
+        self.assertEqual(
+            self.node_1.clients[0].candidate_block["sequence_number"], 2)
+        self.assertEqual(
+            self.node_2.clients[0].candidate_block["sequence_number"], 2)
+        self.assertNotEqual(self.node_1.clients[0].candidate_block_history, [])
         self.assertEqual(len(self.node_1.clients[0].candidate_block_history),
                          2)
-        self.assertEqual(self.node_1.clients[0].candidate_block_history[1]["sequence_number"],
-                         1)        
-        self.assertEqual(self.node_1.clients[0].candidate_block_history[0]["sequence_number"],
-                            0)                                                                  
-        self.assertNotEqual(self.node_2.clients[0].candidate_block_history,
-                         [])
+        self.assertEqual(
+            self.node_1.clients[0].candidate_block_history[1]
+            ["sequence_number"], 1)
+        self.assertEqual(
+            self.node_1.clients[0].candidate_block_history[0]
+            ["sequence_number"], 0)
+        self.assertNotEqual(self.node_2.clients[0].candidate_block_history, [])
         self.assertEqual(len(self.node_2.clients[0].candidate_block_history),
-                         2)  
-        self.assertEqual(self.node_2.clients[0].candidate_block_history[1]["sequence_number"],
-                         1)  
-        self.assertEqual(self.node_2.clients[0].candidate_block_history[0]["sequence_number"],
-                            0)                                    
-
+                         2)
+        self.assertEqual(
+            self.node_2.clients[0].candidate_block_history[1]
+            ["sequence_number"], 1)
+        self.assertEqual(
+            self.node_2.clients[0].candidate_block_history[0]
+            ["sequence_number"], 0)
 
         the_block.sequence_number = 3
         self.node_0.send_my_block(the_block)
@@ -1386,7 +1422,7 @@ def test_send_my_block_get_candidate_block_multiple(self):
         self.assertEqual(len(self.node_1.clients[0].candidate_block_history),
                          4)
         self.assertEqual(len(self.node_2.clients[0].candidate_block_history),
-                         4) 
+                         4)
         the_block.sequence_number = 5
         self.node_0.send_my_block(the_block)
         time.sleep(2)
@@ -1394,61 +1430,66 @@ def test_send_my_block_get_candidate_block_multiple(self):
         self.assertEqual(len(self.node_1.clients[0].candidate_block_history),
                          5)
         self.assertEqual(len(self.node_2.clients[0].candidate_block_history),
-                         5)  
+                         5)
 
-        self.assertEqual(self.node_1.clients[0].candidate_block_history[0]["sequence_number"],
-                            0)         
-        self.assertEqual(self.node_2.clients[0].candidate_block_history[0]["sequence_number"],
-                            0)                                     
+        self.assertEqual(
+            self.node_1.clients[0].candidate_block_history[0]
+            ["sequence_number"], 0)
+        self.assertEqual(
+            self.node_2.clients[0].candidate_block_history[0]
+            ["sequence_number"], 0)
 
         the_block.sequence_number = 6
         self.node_0.send_my_block(the_block)
         time.sleep(2)
-        self.assertEqual(self.node_1.clients[0].candidate_block["sequence_number"],
-                         6)
-        self.assertEqual(self.node_2.clients[0].candidate_block["sequence_number"],
-                         6)           
+        self.assertEqual(
+            self.node_1.clients[0].candidate_block["sequence_number"], 6)
+        self.assertEqual(
+            self.node_2.clients[0].candidate_block["sequence_number"], 6)
         self.assertEqual(len(self.node_1.clients[0].candidate_block_history),
                          5)
         self.assertEqual(len(self.node_2.clients[0].candidate_block_history),
-                         5)  
-
-        self.assertEqual(self.node_1.clients[0].candidate_block_history[0]["sequence_number"],
-                            1)         
-        self.assertEqual(self.node_2.clients[0].candidate_block_history[0]["sequence_number"],
-                            1)  
-
-
-        self.assertEqual(self.node_1.clients[0].candidate_block_history[4]["sequence_number"],
-                            5)  
-        self.assertEqual(self.node_2.clients[0].candidate_block_history[4]["sequence_number"],
-                            5)  
-
+                         5)
 
+        self.assertEqual(
+            self.node_1.clients[0].candidate_block_history[0]
+            ["sequence_number"], 1)
+        self.assertEqual(
+            self.node_2.clients[0].candidate_block_history[0]
+            ["sequence_number"], 1)
 
+        self.assertEqual(
+            self.node_1.clients[0].candidate_block_history[4]
+            ["sequence_number"], 5)
+        self.assertEqual(
+            self.node_2.clients[0].candidate_block_history[4]
+            ["sequence_number"], 5)
 
         the_block.sequence_number = 7
         self.node_0.send_my_block(the_block)
         time.sleep(2)
-        self.assertEqual(self.node_1.clients[0].candidate_block["sequence_number"],
-                         7)
-        self.assertEqual(self.node_2.clients[0].candidate_block["sequence_number"],
-                         7)           
+        self.assertEqual(
+            self.node_1.clients[0].candidate_block["sequence_number"], 7)
+        self.assertEqual(
+            self.node_2.clients[0].candidate_block["sequence_number"], 7)
         self.assertEqual(len(self.node_1.clients[0].candidate_block_history),
                          5)
         self.assertEqual(len(self.node_2.clients[0].candidate_block_history),
-                         5)  
-
-        self.assertEqual(self.node_1.clients[0].candidate_block_history[0]["sequence_number"],
-                            2)         
-        self.assertEqual(self.node_2.clients[0].candidate_block_history[0]["sequence_number"],
-                            2)  
+                         5)
 
+        self.assertEqual(
+            self.node_1.clients[0].candidate_block_history[0]
+            ["sequence_number"], 2)
+        self.assertEqual(
+            self.node_2.clients[0].candidate_block_history[0]
+            ["sequence_number"], 2)
 
-        self.assertEqual(self.node_1.clients[0].candidate_block_history[4]["sequence_number"],
-                            6)  
-        self.assertEqual(self.node_2.clients[0].candidate_block_history[4]["sequence_number"],
-                            6)
+        self.assertEqual(
+            self.node_1.clients[0].candidate_block_history[4]
+            ["sequence_number"], 6)
+        self.assertEqual(
+            self.node_2.clients[0].candidate_block_history[4]
+            ["sequence_number"], 6)
 
         CleanUp_tests()
 
@@ -1456,7 +1497,7 @@ def test_send_my_block_get_candidate_block_hash_multiple(self):
         self.node_1.clients[0].candidate_block_hash = None
         self.node_1.clients[0].candidate_block_hash_history = []
         self.node_2.clients[0].candidate_block_hash = None
-        self.node_2.clients[0].candidate_block_hash_history = []        
+        self.node_2.clients[0].candidate_block_hash_history = []
         self.maxDiff = None
         CleanUp_tests()
 
@@ -1465,10 +1506,10 @@ def test_send_my_block_get_candidate_block_hash_multiple(self):
         self.node_0.send_my_block_hash(the_block)
         time.sleep(2)
 
-        self.assertEqual(self.node_1.clients[0].candidate_block_hash["sequence_number"],
-                         0)
-        self.assertEqual(self.node_2.clients[0].candidate_block_hash["sequence_number"],
-                         0)
+        self.assertEqual(
+            self.node_1.clients[0].candidate_block_hash["sequence_number"], 0)
+        self.assertEqual(
+            self.node_2.clients[0].candidate_block_hash["sequence_number"], 0)
 
         self.assertEqual(self.node_1.clients[0].candidate_block_hash_history,
                          [])
@@ -1479,51 +1520,53 @@ def test_send_my_block_get_candidate_block_hash_multiple(self):
         self.node_0.send_my_block_hash(the_block)
         time.sleep(2)
 
-        self.assertEqual(self.node_1.clients[0].candidate_block_hash["sequence_number"],
-                         1)
-        self.assertEqual(self.node_2.clients[0].candidate_block_hash["sequence_number"],
-                         1)                      
-        self.assertNotEqual(self.node_1.clients[0].candidate_block_hash_history,
-                         [])
-        self.assertEqual(len(self.node_1.clients[0].candidate_block_hash_history),
-                         1)
-        self.assertEqual(self.node_1.clients[0].candidate_block_hash_history[0]["sequence_number"],
-                         0)                                              
-        self.assertNotEqual(self.node_2.clients[0].candidate_block_hash_history,
-                         [])
-        self.assertEqual(len(self.node_2.clients[0].candidate_block_hash_history),
-                         1)  
-        self.assertEqual(self.node_2.clients[0].candidate_block_hash_history[0]["sequence_number"],
-                         0)    
-
-
-
+        self.assertEqual(
+            self.node_1.clients[0].candidate_block_hash["sequence_number"], 1)
+        self.assertEqual(
+            self.node_2.clients[0].candidate_block_hash["sequence_number"], 1)
+        self.assertNotEqual(
+            self.node_1.clients[0].candidate_block_hash_history, [])
+        self.assertEqual(
+            len(self.node_1.clients[0].candidate_block_hash_history), 1)
+        self.assertEqual(
+            self.node_1.clients[0].candidate_block_hash_history[0]
+            ["sequence_number"], 0)
+        self.assertNotEqual(
+            self.node_2.clients[0].candidate_block_hash_history, [])
+        self.assertEqual(
+            len(self.node_2.clients[0].candidate_block_hash_history), 1)
+        self.assertEqual(
+            self.node_2.clients[0].candidate_block_hash_history[0]
+            ["sequence_number"], 0)
 
         the_block.sequence_number = 2
         self.node_0.send_my_block_hash(the_block)
         time.sleep(2)
 
-        self.assertEqual(self.node_1.clients[0].candidate_block_hash["sequence_number"],
-                         2)
-        self.assertEqual(self.node_2.clients[0].candidate_block_hash["sequence_number"],
-                         2)                      
-        self.assertNotEqual(self.node_1.clients[0].candidate_block_hash_history,
-                         [])
-        self.assertEqual(len(self.node_1.clients[0].candidate_block_hash_history),
-                         2)
-        self.assertEqual(self.node_1.clients[0].candidate_block_hash_history[1]["sequence_number"],
-                         1)        
-        self.assertEqual(self.node_1.clients[0].candidate_block_hash_history[0]["sequence_number"],
-                            0)                                                                  
-        self.assertNotEqual(self.node_2.clients[0].candidate_block_hash_history,
-                         [])
-        self.assertEqual(len(self.node_2.clients[0].candidate_block_hash_history),
-                         2)  
-        self.assertEqual(self.node_2.clients[0].candidate_block_hash_history[1]["sequence_number"],
-                         1)  
-        self.assertEqual(self.node_2.clients[0].candidate_block_hash_history[0]["sequence_number"],
-                            0)                                    
-
+        self.assertEqual(
+            self.node_1.clients[0].candidate_block_hash["sequence_number"], 2)
+        self.assertEqual(
+            self.node_2.clients[0].candidate_block_hash["sequence_number"], 2)
+        self.assertNotEqual(
+            self.node_1.clients[0].candidate_block_hash_history, [])
+        self.assertEqual(
+            len(self.node_1.clients[0].candidate_block_hash_history), 2)
+        self.assertEqual(
+            self.node_1.clients[0].candidate_block_hash_history[1]
+            ["sequence_number"], 1)
+        self.assertEqual(
+            self.node_1.clients[0].candidate_block_hash_history[0]
+            ["sequence_number"], 0)
+        self.assertNotEqual(
+            self.node_2.clients[0].candidate_block_hash_history, [])
+        self.assertEqual(
+            len(self.node_2.clients[0].candidate_block_hash_history), 2)
+        self.assertEqual(
+            self.node_2.clients[0].candidate_block_hash_history[1]
+            ["sequence_number"], 1)
+        self.assertEqual(
+            self.node_2.clients[0].candidate_block_hash_history[0]
+            ["sequence_number"], 0)
 
         the_block.sequence_number = 3
         self.node_0.send_my_block_hash(the_block)
@@ -1532,89 +1575,94 @@ def test_send_my_block_get_candidate_block_hash_multiple(self):
         the_block.sequence_number = 4
         self.node_0.send_my_block_hash(the_block)
         time.sleep(2)
-        self.assertEqual(len(self.node_1.clients[0].candidate_block_hash_history),
-                         4)
-        self.assertEqual(len(self.node_2.clients[0].candidate_block_hash_history),
-                         4) 
+        self.assertEqual(
+            len(self.node_1.clients[0].candidate_block_hash_history), 4)
+        self.assertEqual(
+            len(self.node_2.clients[0].candidate_block_hash_history), 4)
         the_block.sequence_number = 5
         self.node_0.send_my_block_hash(the_block)
         time.sleep(2)
 
-        self.assertEqual(len(self.node_1.clients[0].candidate_block_hash_history),
-                         5)
-        self.assertEqual(len(self.node_2.clients[0].candidate_block_hash_history),
-                         5)  
+        self.assertEqual(
+            len(self.node_1.clients[0].candidate_block_hash_history), 5)
+        self.assertEqual(
+            len(self.node_2.clients[0].candidate_block_hash_history), 5)
 
-        self.assertEqual(self.node_1.clients[0].candidate_block_hash_history[0]["sequence_number"],
-                            0)         
-        self.assertEqual(self.node_2.clients[0].candidate_block_hash_history[0]["sequence_number"],
-                            0)                                     
+        self.assertEqual(
+            self.node_1.clients[0].candidate_block_hash_history[0]
+            ["sequence_number"], 0)
+        self.assertEqual(
+            self.node_2.clients[0].candidate_block_hash_history[0]
+            ["sequence_number"], 0)
 
         the_block.sequence_number = 6
         self.node_0.send_my_block_hash(the_block)
         time.sleep(2)
-        self.assertEqual(self.node_1.clients[0].candidate_block_hash["sequence_number"],
-                         6)
-        self.assertEqual(self.node_2.clients[0].candidate_block_hash["sequence_number"],
-                         6)           
-        self.assertEqual(len(self.node_1.clients[0].candidate_block_hash_history),
-                         5)
-        self.assertEqual(len(self.node_2.clients[0].candidate_block_hash_history),
-                         5)  
-
-        self.assertEqual(self.node_1.clients[0].candidate_block_hash_history[0]["sequence_number"],
-                            1)         
-        self.assertEqual(self.node_2.clients[0].candidate_block_hash_history[0]["sequence_number"],
-                            1)  
-
-
-        self.assertEqual(self.node_1.clients[0].candidate_block_hash_history[4]["sequence_number"],
-                            5)  
-        self.assertEqual(self.node_2.clients[0].candidate_block_hash_history[4]["sequence_number"],
-                            5)  
-
+        self.assertEqual(
+            self.node_1.clients[0].candidate_block_hash["sequence_number"], 6)
+        self.assertEqual(
+            self.node_2.clients[0].candidate_block_hash["sequence_number"], 6)
+        self.assertEqual(
+            len(self.node_1.clients[0].candidate_block_hash_history), 5)
+        self.assertEqual(
+            len(self.node_2.clients[0].candidate_block_hash_history), 5)
 
+        self.assertEqual(
+            self.node_1.clients[0].candidate_block_hash_history[0]
+            ["sequence_number"], 1)
+        self.assertEqual(
+            self.node_2.clients[0].candidate_block_hash_history[0]
+            ["sequence_number"], 1)
 
+        self.assertEqual(
+            self.node_1.clients[0].candidate_block_hash_history[4]
+            ["sequence_number"], 5)
+        self.assertEqual(
+            self.node_2.clients[0].candidate_block_hash_history[4]
+            ["sequence_number"], 5)
 
         the_block.sequence_number = 7
         self.node_0.send_my_block_hash(the_block)
         time.sleep(2)
-        self.assertEqual(self.node_1.clients[0].candidate_block_hash["sequence_number"],
-                         7)
-        self.assertEqual(self.node_2.clients[0].candidate_block_hash["sequence_number"],
-                         7)           
-        self.assertEqual(len(self.node_1.clients[0].candidate_block_hash_history),
-                         5)
-        self.assertEqual(len(self.node_2.clients[0].candidate_block_hash_history),
-                         5)  
-
-        self.assertEqual(self.node_1.clients[0].candidate_block_hash_history[0]["sequence_number"],
-                            2)         
-        self.assertEqual(self.node_2.clients[0].candidate_block_hash_history[0]["sequence_number"],
-                            2)  
+        self.assertEqual(
+            self.node_1.clients[0].candidate_block_hash["sequence_number"], 7)
+        self.assertEqual(
+            self.node_2.clients[0].candidate_block_hash["sequence_number"], 7)
+        self.assertEqual(
+            len(self.node_1.clients[0].candidate_block_hash_history), 5)
+        self.assertEqual(
+            len(self.node_2.clients[0].candidate_block_hash_history), 5)
 
+        self.assertEqual(
+            self.node_1.clients[0].candidate_block_hash_history[0]
+            ["sequence_number"], 2)
+        self.assertEqual(
+            self.node_2.clients[0].candidate_block_hash_history[0]
+            ["sequence_number"], 2)
 
-        self.assertEqual(self.node_1.clients[0].candidate_block_hash_history[4]["sequence_number"],
-                            6)  
-        self.assertEqual(self.node_2.clients[0].candidate_block_hash_history[4]["sequence_number"],
-                            6)
+        self.assertEqual(
+            self.node_1.clients[0].candidate_block_hash_history[4]
+            ["sequence_number"], 6)
+        self.assertEqual(
+            self.node_2.clients[0].candidate_block_hash_history[4]
+            ["sequence_number"], 6)
 
         CleanUp_tests()
 
-
-    def test_send_my_block_get_candidate_block_multiple_with_function_try(self):
+    def test_send_my_block_get_candidate_block_multiple_with_function_try(
+            self):
         self.node_1.clients[0].candidate_block = None
         self.node_1.clients[0].candidate_block_history = []
         self.node_1.clients[1].candidate_block = None
-        self.node_1.clients[1].candidate_block_history = []  
+        self.node_1.clients[1].candidate_block_history = []
         self.node_2.clients[0].candidate_block = None
         self.node_2.clients[0].candidate_block_history = []
         self.node_2.clients[1].candidate_block = None
-        self.node_2.clients[1].candidate_block_history = []  
+        self.node_2.clients[1].candidate_block_history = []
         self.node_0.clients[0].candidate_block = None
         self.node_0.clients[0].candidate_block_history = []
         self.node_0.clients[1].candidate_block = None
-        self.node_0.clients[1].candidate_block_history = []  
+        self.node_0.clients[1].candidate_block_history = []
 
         self.maxDiff = None
         CleanUp_tests()
@@ -1624,25 +1672,16 @@ def test_send_my_block_get_candidate_block_multiple_with_function_try(self):
         self.node_0.send_my_block(the_block)
         time.sleep(2)
 
-
-
         the_block.sequence_number = 1
         self.node_1.send_my_block(the_block)
         self.node_0.send_my_block(the_block)
         time.sleep(2)
 
-    
-
-
-
         the_block.sequence_number = 2
         self.node_1.send_my_block(the_block)
         self.node_0.send_my_block(the_block)
         time.sleep(2)
 
-                               
-
-
         the_block.sequence_number = 3
         self.node_1.send_my_block(the_block)
         self.node_0.send_my_block(the_block)
@@ -1653,60 +1692,58 @@ def test_send_my_block_get_candidate_block_multiple_with_function_try(self):
         self.node_0.send_my_block(the_block)
         time.sleep(2)
 
-
         the_block.sequence_number = 5
         self.node_1.send_my_block(the_block)
         self.node_0.send_my_block(the_block)
         time.sleep(2)
-                                
 
         the_block.sequence_number = 6
         self.node_1.send_my_block(the_block)
         self.node_0.send_my_block(the_block)
         time.sleep(2)
 
-
-
         the_block.sequence_number = 7
         self.node_1.send_my_block(the_block)
         self.node_0.send_my_block(the_block)
         time.sleep(2)
 
-
         nodes = [self.node_2.clients[0], self.node_2.clients[1]]
 
-        candidate_blocks = GetCandidateBlocks(custom_nodes_list=nodes, block=the_block)
+        candidate_blocks = GetCandidateBlocks(custom_nodes_list=nodes,
+                                              block=the_block)
         self.assertEqual(len(candidate_blocks.candidate_blocks), 3)
 
         the_block.sequence_number = 2
-        candidate_blocks = GetCandidateBlocks(custom_nodes_list=nodes, block=the_block)
+        candidate_blocks = GetCandidateBlocks(custom_nodes_list=nodes,
+                                              block=the_block)
         self.assertEqual(len(candidate_blocks.candidate_blocks), 3)
 
-
         the_block.sequence_number = 1
-        candidate_blocks = GetCandidateBlocks(custom_nodes_list=nodes, block=the_block)
+        candidate_blocks = GetCandidateBlocks(custom_nodes_list=nodes,
+                                              block=the_block)
         self.assertEqual(len(candidate_blocks.candidate_blocks), 1)
 
-
         the_block.sequence_number = 6
-        candidate_blocks = GetCandidateBlocks(custom_nodes_list=nodes, block=the_block)
+        candidate_blocks = GetCandidateBlocks(custom_nodes_list=nodes,
+                                              block=the_block)
         self.assertEqual(len(candidate_blocks.candidate_blocks), 3)
 
         CleanUp_tests()
 
-    def test_send_my_block_get_candidate_block_hash_multiple_with_function_try(self):
+    def test_send_my_block_get_candidate_block_hash_multiple_with_function_try(
+            self):
         self.node_1.clients[0].candidate_block_hash = None
         self.node_1.clients[0].candidate_block_hash_history = []
         self.node_1.clients[1].candidate_block_hash = None
-        self.node_1.clients[1].candidate_block_hash_history = []  
+        self.node_1.clients[1].candidate_block_hash_history = []
         self.node_2.clients[0].candidate_block_hash = None
         self.node_2.clients[0].candidate_block_hash_history = []
         self.node_2.clients[1].candidate_block_hash = None
-        self.node_2.clients[1].candidate_block_hash_history = []  
+        self.node_2.clients[1].candidate_block_hash_history = []
         self.node_0.clients[0].candidate_block_hash = None
         self.node_0.clients[0].candidate_block_hash_history = []
         self.node_0.clients[1].candidate_block_hash = None
-        self.node_0.clients[1].candidate_block_hash_history = []  
+        self.node_0.clients[1].candidate_block_hash_history = []
 
         self.maxDiff = None
         CleanUp_tests()
@@ -1717,25 +1754,16 @@ def test_send_my_block_get_candidate_block_hash_multiple_with_function_try(self)
         self.node_0.send_my_block_hash(the_block)
         time.sleep(2)
 
-
-
         the_block.sequence_number = 1
         self.node_1.send_my_block_hash(the_block)
         self.node_0.send_my_block_hash(the_block)
         time.sleep(2)
 
-    
-
-
-
         the_block.sequence_number = 2
         self.node_1.send_my_block_hash(the_block)
         self.node_0.send_my_block_hash(the_block)
         time.sleep(2)
 
-                               
-
-
         the_block.sequence_number = 3
         self.node_1.send_my_block_hash(the_block)
         self.node_0.send_my_block_hash(the_block)
@@ -1746,83 +1774,81 @@ def test_send_my_block_get_candidate_block_hash_multiple_with_function_try(self)
         self.node_0.send_my_block_hash(the_block)
         time.sleep(2)
 
-
         the_block.sequence_number = 5
         self.node_1.send_my_block_hash(the_block)
         self.node_0.send_my_block_hash(the_block)
         time.sleep(2)
-                                
 
         the_block.sequence_number = 6
         self.node_1.send_my_block_hash(the_block)
         self.node_0.send_my_block_hash(the_block)
         time.sleep(2)
 
-
-
         the_block.sequence_number = 7
         self.node_1.send_my_block_hash(the_block)
         self.node_0.send_my_block_hash(the_block)
         time.sleep(2)
 
-
         nodes = [self.node_2.clients[0], self.node_2.clients[1]]
 
-        candidate_blocks = GetCandidateBlocks(custom_nodes_list=nodes, block=the_block)
+        candidate_blocks = GetCandidateBlocks(custom_nodes_list=nodes,
+                                              block=the_block)
         self.assertEqual(len(candidate_blocks.candidate_block_hashes), 3)
 
         the_block.sequence_number = 2
-        candidate_blocks = GetCandidateBlocks(custom_nodes_list=nodes, block=the_block)
+        candidate_blocks = GetCandidateBlocks(custom_nodes_list=nodes,
+                                              block=the_block)
         self.assertEqual(len(candidate_blocks.candidate_block_hashes), 3)
 
-
         the_block.sequence_number = 1
-        candidate_blocks = GetCandidateBlocks(custom_nodes_list=nodes, block=the_block)
+        candidate_blocks = GetCandidateBlocks(custom_nodes_list=nodes,
+                                              block=the_block)
         self.assertEqual(len(candidate_blocks.candidate_block_hashes), 1)
 
-
         the_block.sequence_number = 6
-        candidate_blocks = GetCandidateBlocks(custom_nodes_list=nodes, block=the_block)
+        candidate_blocks = GetCandidateBlocks(custom_nodes_list=nodes,
+                                              block=the_block)
         self.assertEqual(len(candidate_blocks.candidate_block_hashes), 3)
 
         CleanUp_tests()
 
-    def test_send_my_block_get_candidate_block_multiple_with_function_try_non(self):
+    def test_send_my_block_get_candidate_block_multiple_with_function_try_non(
+            self):
         self.node_1.clients[0].candidate_block = None
         self.node_1.clients[0].candidate_block_history = []
         self.node_1.clients[1].candidate_block = None
-        self.node_1.clients[1].candidate_block_history = []  
+        self.node_1.clients[1].candidate_block_history = []
         self.node_2.clients[0].candidate_block = None
         self.node_2.clients[0].candidate_block_history = []
         self.node_2.clients[1].candidate_block = None
-        self.node_2.clients[1].candidate_block_history = []  
+        self.node_2.clients[1].candidate_block_history = []
         self.node_0.clients[0].candidate_block = None
         self.node_0.clients[0].candidate_block_history = []
         self.node_0.clients[1].candidate_block = None
-        self.node_0.clients[1].candidate_block_history = []  
+        self.node_0.clients[1].candidate_block_history = []
 
         self.maxDiff = None
         CleanUp_tests()
 
         the_block = Block("onuratakanulusoy")
         nodes = [self.node_2.clients[0], self.node_2.clients[1]]
-        candidate_blocks = GetCandidateBlocks(custom_nodes_list=nodes, block=the_block)
+        candidate_blocks = GetCandidateBlocks(custom_nodes_list=nodes,
+                                              block=the_block)
         self.assertEqual(len(candidate_blocks.candidate_blocks), 1)
 
-
         the_block.sequence_number = 6
-        candidate_blocks = GetCandidateBlocks(custom_nodes_list=nodes, block=the_block)
+        candidate_blocks = GetCandidateBlocks(custom_nodes_list=nodes,
+                                              block=the_block)
         self.assertEqual(len(candidate_blocks.candidate_blocks), 1)
 
         CleanUp_tests()
 
-    def test_send_my_block_get_candidate_block_hash_multiple_with_function_try_non(self):
-
+    def test_send_my_block_get_candidate_block_hash_multiple_with_function_try_non(
+        self, ):
         self.node_2.clients[0].candidate_block_hash = None
         self.node_2.clients[0].candidate_block_hash_history = []
         self.node_2.clients[1].candidate_block_hash = None
-        self.node_2.clients[1].candidate_block_hash_history = []  
-
+        self.node_2.clients[1].candidate_block_hash_history = []
 
         self.maxDiff = None
         CleanUp_tests()
@@ -1830,14 +1856,19 @@ def test_send_my_block_get_candidate_block_hash_multiple_with_function_try_non(s
         the_block = Block("onuratakanulusoy")
         the_block.hash = "onurata"
         nodes = [self.node_2.clients[0], self.node_2.clients[1]]
-        candidate_blocks = GetCandidateBlocks(custom_nodes_list=nodes, block=the_block)
+        candidate_blocks = GetCandidateBlocks(custom_nodes_list=nodes,
+                                              block=the_block)
         self.assertEqual(len(candidate_blocks.candidate_block_hashes), 1)
 
-
         the_block.sequence_number = 6
-        candidate_blocks = GetCandidateBlocks(custom_nodes_list=nodes, block=the_block)
+        candidate_blocks = GetCandidateBlocks(custom_nodes_list=nodes,
+                                              block=the_block)
         self.assertEqual(len(candidate_blocks.candidate_block_hashes), 1)
 
         CleanUp_tests()
 
+
+backup = sys.argv
+sys.argv = [sys.argv[0]]
 unittest.main(exit=False)
+sys.argv = backup
diff --git a/tests/unit_tests/test_transactions.py b/tests/unit_tests/test_transactions.py
index d3cd23d2..da7e85ba 100644
--- a/tests/unit_tests/test_transactions.py
+++ b/tests/unit_tests/test_transactions.py
@@ -2696,4 +2696,7 @@ def test_cleaner_pending_one_delete(self):
         DeletePending(transaction_frem_a_1_q_3)
 
 
+backup = sys.argv
+sys.argv = [sys.argv[0]]
 unittest.main(exit=False)
+sys.argv = backup
diff --git a/tests/unit_tests/test_wallet.py b/tests/unit_tests/test_wallet.py
index d0b712a0..7b3c0177 100644
--- a/tests/unit_tests/test_wallet.py
+++ b/tests/unit_tests/test_wallet.py
@@ -14,7 +14,7 @@
 from naruno.lib.clean_up import CleanUp_tests
 from naruno.lib.encryption import decrypt
 from naruno.lib.settings_system import (change_wallet, save_settings,
-                                                  the_settings)
+                                        the_settings)
 from naruno.wallet.delete_current_wallet import delete_current_wallet
 from naruno.wallet.ellipticcurve.privateKey import PrivateKey
 from naruno.wallet.ellipticcurve.publicKey import PublicKey
@@ -24,7 +24,7 @@
 from naruno.wallet.wallet_create import wallet_create
 from naruno.wallet.wallet_delete import wallet_delete
 from naruno.wallet.wallet_import import (Address, wallet_import,
-                                                   wallet_import_all)
+                                         wallet_import_all)
 from naruno.wallet.wallet_selector import wallet_selector
 
 
@@ -35,7 +35,6 @@ def setUpClass(cls):
         CleanUp_tests()
 
     def test_wallet_by_creating_saving_importing_and_deleting_a_wallet(self):
-
         password = "123"
 
         temp_private_key = wallet_create(password)
@@ -57,7 +56,6 @@ def test_wallet_by_creating_saving_importing_and_deleting_a_wallet(self):
                          "A problem on the saving and importing the wallet.")
 
     def test_wallet_by_private_pem_conversion(self):
-
         password = "123"
 
         temp_private_key_class = wallet_create(password, save=False)
@@ -67,7 +65,6 @@ def test_wallet_by_private_pem_conversion(self):
         self.assertEqual(temp_private_key_class.curve, privateKey2.curve)
 
     def test_wallet_by_public_conversion(self):
-
         password = "123"
 
         privateKey = wallet_create(password, save=False)
@@ -79,7 +76,6 @@ def test_wallet_by_public_conversion(self):
         self.assertEqual(publicKey1.curve, publicKey2.curve)
 
     def test_wallet_selector_empty(self):
-
         original_saved_wallets = get_saved_wallet()
         save_wallet_list({})
 
@@ -328,4 +324,7 @@ def test_wallet_import_all(self):
         self.assertEqual(result, [w_1, w_2])
 
 
+backup = sys.argv
+sys.argv = [sys.argv[0]]
 unittest.main(exit=False)
+sys.argv = backup