mirror of
https://github.com/basicswap/basicswap.git
synced 2025-03-08 01:36:02 +00:00
parent
a0456cb689
commit
831ef40977
8 changed files with 69 additions and 57 deletions
|
@ -6,15 +6,15 @@
|
|||
# Distributed under the MIT software license, see the accompanying
|
||||
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import logging
|
||||
import multiprocessing
|
||||
import os
|
||||
import shutil
|
||||
import signal
|
||||
import logging
|
||||
import unittest
|
||||
import sys
|
||||
import threading
|
||||
import multiprocessing
|
||||
import unittest
|
||||
from io import StringIO
|
||||
from urllib.request import urlopen
|
||||
from unittest.mock import patch
|
||||
|
@ -534,7 +534,7 @@ class TestBase(unittest.TestCase):
|
|||
)
|
||||
|
||||
def signal_handler(self, sig, frame):
|
||||
logging.info("signal {} detected.".format(sig))
|
||||
os.write(sys.stdout.fileno(), f"Signal {sig} detected.\n".encode("utf-8"))
|
||||
self.delay_event.set()
|
||||
|
||||
def wait_seconds(self, seconds):
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2022-2023 tecnovert
|
||||
# Copyright (c) 2024 The Basicswap developers
|
||||
# Copyright (c) 2024-2025 The Basicswap developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
@ -11,16 +11,16 @@ basicswap]$ python tests/basicswap/extended/test_dash.py
|
|||
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import time
|
||||
import logging
|
||||
import os
|
||||
import random
|
||||
import shutil
|
||||
import signal
|
||||
import logging
|
||||
import unittest
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
import unittest
|
||||
|
||||
import basicswap.config as cfg
|
||||
from basicswap.basicswap import (
|
||||
|
@ -251,7 +251,7 @@ def dashRpc(cmd, wallet=None):
|
|||
|
||||
def signal_handler(sig, frame):
|
||||
global stop_test
|
||||
print("signal {} detected.".format(sig))
|
||||
os.write(sys.stdout.fileno(), f"Signal {sig} detected.\n".encode("utf-8"))
|
||||
stop_test = True
|
||||
delay_event.set()
|
||||
|
||||
|
|
|
@ -2,19 +2,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2020-2021 tecnovert
|
||||
# Copyright (c) 2024 The Basicswap developers
|
||||
# Copyright (c) 2024-2025 The Basicswap developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
import os
|
||||
import json
|
||||
import time
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
import signal
|
||||
import logging
|
||||
import unittest
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
import traceback
|
||||
import unittest
|
||||
|
||||
import basicswap.config as cfg
|
||||
from basicswap.basicswap import (
|
||||
|
@ -150,7 +151,7 @@ def btcRpc(cmd, node_id=0):
|
|||
|
||||
def signal_handler(sig, frame):
|
||||
global stop_test
|
||||
logging.info("signal {} detected.".format(sig))
|
||||
os.write(sys.stdout.fileno(), f"Signal {sig} detected.\n".encode("utf-8"))
|
||||
stop_test = True
|
||||
delay_event.set()
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2019-2021 tecnovert
|
||||
# Copyright (c) 2024 The Basicswap developers
|
||||
# Copyright (c) 2024-2025 The Basicswap developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
@ -11,15 +11,15 @@ basicswap]$ python tests/basicswap/extended/test_nmc.py
|
|||
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import time
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
import signal
|
||||
import logging
|
||||
import unittest
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
import unittest
|
||||
|
||||
import basicswap.config as cfg
|
||||
from basicswap.basicswap import (
|
||||
|
@ -231,7 +231,7 @@ def nmcRpc(cmd):
|
|||
|
||||
def signal_handler(sig, frame):
|
||||
global stop_test
|
||||
print("signal {} detected.".format(sig))
|
||||
os.write(sys.stdout.fileno(), f"Signal {sig} detected.\n".encode("utf-8"))
|
||||
stop_test = True
|
||||
delay_event.set()
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2022-2023 tecnovert
|
||||
# Copyright (c) 2024 The Basicswap developers
|
||||
# Copyright (c) 2024-2025 The Basicswap developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
@ -11,16 +11,16 @@ basicswap]$ python tests/basicswap/extended/test_pivx.py
|
|||
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import time
|
||||
import logging
|
||||
import os
|
||||
import random
|
||||
import shutil
|
||||
import signal
|
||||
import logging
|
||||
import unittest
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
import unittest
|
||||
|
||||
import basicswap.config as cfg
|
||||
from basicswap.basicswap import (
|
||||
|
@ -256,7 +256,7 @@ def pivxRpc(cmd):
|
|||
|
||||
def signal_handler(sig, frame):
|
||||
global stop_test
|
||||
print("signal {} detected.".format(sig))
|
||||
os.write(sys.stdout.fileno(), f"Signal {sig} detected.\n".encode("utf-8"))
|
||||
stop_test = True
|
||||
delay_event.set()
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2023-2024 tecnovert
|
||||
# Copyright (c) 2024 The Basicswap developers
|
||||
# Copyright (c) 2024-2025 The Basicswap developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
@ -15,17 +15,18 @@ pytest -v -s tests/basicswap/extended/test_scripts.py::Test::test_bid_tracking
|
|||
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import time
|
||||
import math
|
||||
import logging
|
||||
import sqlite3
|
||||
import unittest
|
||||
import threading
|
||||
import subprocess
|
||||
import http.client
|
||||
import json
|
||||
import logging
|
||||
import math
|
||||
import os
|
||||
import signal
|
||||
import sqlite3
|
||||
import subprocess
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
import unittest
|
||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||
from urllib import parse
|
||||
|
||||
|
@ -196,6 +197,11 @@ def get_possible_bids(rv_stdout):
|
|||
return bids
|
||||
|
||||
|
||||
def signal_handler(self, sig, frame):
|
||||
os.write(sys.stdout.fileno(), f"Signal {sig} detected.\n".encode("utf-8"))
|
||||
self.delay_event.set()
|
||||
|
||||
|
||||
class Test(unittest.TestCase):
|
||||
delay_event = threading.Event()
|
||||
thread_http = HttpThread()
|
||||
|
@ -203,6 +209,11 @@ class Test(unittest.TestCase):
|
|||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super(Test, cls).setUpClass()
|
||||
|
||||
signal.signal(
|
||||
signal.SIGINT, lambda signal, frame: signal_handler(cls, signal, frame)
|
||||
)
|
||||
|
||||
cls.thread_http.start()
|
||||
|
||||
script_path = "scripts/createoffers.py"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (c) 2021-2024 tecnovert
|
||||
# Copyright (c) 2024 The Basicswap developers
|
||||
# Copyright (c) 2024-2025 The Basicswap developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
@ -22,16 +22,16 @@ cp -r ${TEST_PATH}/bin/ ~/tmp/basicswap_bin/
|
|||
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import time
|
||||
import logging
|
||||
import multiprocessing
|
||||
import os
|
||||
import random
|
||||
import signal
|
||||
import logging
|
||||
import unittest
|
||||
import sys
|
||||
import threading
|
||||
import multiprocessing
|
||||
import time
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
from basicswap.rpc_xmr import (
|
||||
|
@ -219,7 +219,7 @@ def updateThreadDCR(cls):
|
|||
|
||||
|
||||
def signal_handler(self, sig, frame):
|
||||
logging.info("signal {} detected.".format(sig))
|
||||
os.write(sys.stdout.fileno(), f"Signal {sig} detected.\n".encode("utf-8"))
|
||||
self.delay_event.set()
|
||||
|
||||
|
||||
|
|
|
@ -6,16 +6,16 @@
|
|||
# Distributed under the MIT software license, see the accompanying
|
||||
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
import os
|
||||
import json
|
||||
import time
|
||||
import logging
|
||||
import os
|
||||
import random
|
||||
import shutil
|
||||
import signal
|
||||
import logging
|
||||
import unittest
|
||||
import traceback
|
||||
import threading
|
||||
import time
|
||||
import traceback
|
||||
import unittest
|
||||
|
||||
import basicswap.config as cfg
|
||||
from basicswap.db import (
|
||||
|
|
Loading…
Reference in a new issue