refactor: deduplicate threads array

This commit is contained in:
tecnovert
2025-10-15 18:12:24 +02:00
parent 3794b58021
commit 19fd15b9dc
6 changed files with 56 additions and 114 deletions
-13
View File
@@ -42,9 +42,6 @@ from basicswap.basicswap_util import (
from basicswap.util.address import (
toWIF,
)
from basicswap.http_server import (
HttpThread,
)
from tests.basicswap.util import (
read_json_api,
)
@@ -58,7 +55,6 @@ from tests.basicswap.common import (
wait_for_unspent,
wait_for_bid_tx_state,
wait_for_in_progress,
TEST_HTTP_HOST,
TEST_HTTP_PORT,
BASE_PORT,
BASE_RPC_PORT,
@@ -306,7 +302,6 @@ class Test(unittest.TestCase):
cls.daemons = []
cls.swap_clients = []
cls.http_threads = []
btc_data_dir = os.path.join(cfg.TEST_DATADIRS, str(BTC_NODE))
if os.path.exists(os.path.join(cfg.BITCOIN_BINDIR, "bitcoin-wallet")):
@@ -417,10 +412,6 @@ class Test(unittest.TestCase):
sc.start()
t = HttpThread(TEST_HTTP_HOST, TEST_HTTP_PORT + i, False, sc)
cls.http_threads.append(t)
t.start()
waitForRPC(dashRpc, delay_event)
num_blocks = 500
logging.info("Mining %d dash blocks", num_blocks)
@@ -473,15 +464,11 @@ class Test(unittest.TestCase):
stop_test = True
cls.update_thread.join()
cls.coins_update_thread.join()
for t in cls.http_threads:
t.stop()
t.join()
for c in cls.swap_clients:
c.finalise()
stopDaemons(cls.daemons)
cls.http_threads.clear()
cls.swap_clients.clear()
cls.daemons.clear()