From 22b644f47ee2de8a962d00588579076e7a55455a Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Fri, 22 Mar 2019 14:35:23 +0000 Subject: [PATCH] functional_tests: move RPC API to utils, it is not test specific --- tests/functional_tests/blockchain.py | 2 +- tests/functional_tests/cold_signing.py | 4 ++-- tests/functional_tests/daemon_info.py | 2 +- tests/functional_tests/functional_tests_rpc.py | 6 ++++++ tests/functional_tests/integrated_address.py | 2 +- tests/functional_tests/mining.py | 4 ++-- tests/functional_tests/multisig.py | 4 ++-- tests/functional_tests/proofs.py | 4 ++-- tests/functional_tests/sign_message.py | 2 +- tests/functional_tests/speed.py | 4 ++-- tests/functional_tests/transfer.py | 4 ++-- tests/functional_tests/txpool.py | 4 ++-- tests/functional_tests/wallet_address.py | 2 +- .../python-rpc/framework}/__init__.py | 0 .../test_framework => utils/python-rpc/framework}/daemon.py | 0 .../test_framework => utils/python-rpc/framework}/rpc.py | 0 .../test_framework => utils/python-rpc/framework}/wallet.py | 0 17 files changed, 25 insertions(+), 19 deletions(-) rename {tests/functional_tests/test_framework => utils/python-rpc/framework}/__init__.py (100%) rename {tests/functional_tests/test_framework => utils/python-rpc/framework}/daemon.py (100%) rename {tests/functional_tests/test_framework => utils/python-rpc/framework}/rpc.py (100%) rename {tests/functional_tests/test_framework => utils/python-rpc/framework}/wallet.py (100%) diff --git a/tests/functional_tests/blockchain.py b/tests/functional_tests/blockchain.py index bdd08680f..d805fccda 100755 --- a/tests/functional_tests/blockchain.py +++ b/tests/functional_tests/blockchain.py @@ -41,7 +41,7 @@ Test the following RPCs: """ -from test_framework.daemon import Daemon +from framework.daemon import Daemon class BlockchainTest(): def run_test(self): diff --git a/tests/functional_tests/cold_signing.py b/tests/functional_tests/cold_signing.py index 2acdcb137..6895aec60 100755 --- a/tests/functional_tests/cold_signing.py +++ b/tests/functional_tests/cold_signing.py @@ -33,8 +33,8 @@ import time """Test cold tx signing """ -from test_framework.daemon import Daemon -from test_framework.wallet import Wallet +from framework.daemon import Daemon +from framework.wallet import Wallet class ColdSigningTest(): def run_test(self): diff --git a/tests/functional_tests/daemon_info.py b/tests/functional_tests/daemon_info.py index 94c3fc3ac..bd3528c3f 100755 --- a/tests/functional_tests/daemon_info.py +++ b/tests/functional_tests/daemon_info.py @@ -36,7 +36,7 @@ Test the following RPCs: """ -from test_framework.daemon import Daemon +from framework.daemon import Daemon class DaemonGetInfoTest(): def run_test(self): diff --git a/tests/functional_tests/functional_tests_rpc.py b/tests/functional_tests/functional_tests_rpc.py index aae546a6b..606b19e45 100755 --- a/tests/functional_tests/functional_tests_rpc.py +++ b/tests/functional_tests/functional_tests_rpc.py @@ -7,6 +7,7 @@ import subprocess from signal import SIGTERM import socket import string +import os USAGE = 'usage: functional_tests_rpc.py [ | all]' DEFAULT_TESTS = ['daemon_info', 'blockchain', 'wallet_address', 'integrated_address', 'mining', 'transfer', 'txpool', 'multisig', 'cold_signing', 'sign_message', 'proofs'] @@ -56,6 +57,11 @@ for i in range(N_WALLETS): print('Starting servers...') try: + PYTHONPATH = os.environ['PYTHONPATH'] if 'PYTHONPATH' in os.environ else '' + if len(PYTHONPATH) > 0: + PYTHONPATH += ':' + PYTHONPATH += '../../utils/python-rpc' + os.environ['PYTHONPATH'] = PYTHONPATH for i in range(len(command_lines)): #print('Running: ' + str(command_lines[i])) processes.append(subprocess.Popen(command_lines[i], stdout = outputs[i])) diff --git a/tests/functional_tests/integrated_address.py b/tests/functional_tests/integrated_address.py index d6976a116..338dd14ae 100755 --- a/tests/functional_tests/integrated_address.py +++ b/tests/functional_tests/integrated_address.py @@ -38,7 +38,7 @@ Test the following RPCs: """ -from test_framework.wallet import Wallet +from framework.wallet import Wallet class IntegratedAddressTest(): def run_test(self): diff --git a/tests/functional_tests/mining.py b/tests/functional_tests/mining.py index a94d59cba..1b189beb2 100755 --- a/tests/functional_tests/mining.py +++ b/tests/functional_tests/mining.py @@ -38,8 +38,8 @@ Test the following RPCs: - mining_status """ -from test_framework.daemon import Daemon -from test_framework.wallet import Wallet +from framework.daemon import Daemon +from framework.wallet import Wallet class MiningTest(): def run_test(self): diff --git a/tests/functional_tests/multisig.py b/tests/functional_tests/multisig.py index 7cdddd009..a0e8551cd 100755 --- a/tests/functional_tests/multisig.py +++ b/tests/functional_tests/multisig.py @@ -33,8 +33,8 @@ import time """Test multisig transfers """ -from test_framework.daemon import Daemon -from test_framework.wallet import Wallet +from framework.daemon import Daemon +from framework.wallet import Wallet class MultisigTest(): def run_test(self): diff --git a/tests/functional_tests/proofs.py b/tests/functional_tests/proofs.py index 03d59b765..0a0b6304d 100755 --- a/tests/functional_tests/proofs.py +++ b/tests/functional_tests/proofs.py @@ -33,8 +33,8 @@ import time """Test misc proofs (tx key, send, receive, reserve) """ -from test_framework.daemon import Daemon -from test_framework.wallet import Wallet +from framework.daemon import Daemon +from framework.wallet import Wallet class ProofsTest(): def run_test(self): diff --git a/tests/functional_tests/sign_message.py b/tests/functional_tests/sign_message.py index 4a62fd733..4c3ec3588 100755 --- a/tests/functional_tests/sign_message.py +++ b/tests/functional_tests/sign_message.py @@ -38,7 +38,7 @@ Test the following RPCs: """ -from test_framework.wallet import Wallet +from framework.wallet import Wallet class MessageSigningTest(): def run_test(self): diff --git a/tests/functional_tests/speed.py b/tests/functional_tests/speed.py index 0ce90f939..bd8892df8 100755 --- a/tests/functional_tests/speed.py +++ b/tests/functional_tests/speed.py @@ -42,8 +42,8 @@ import time from time import sleep from decimal import Decimal -from test_framework.daemon import Daemon -from test_framework.wallet import Wallet +from framework.daemon import Daemon +from framework.wallet import Wallet class SpeedTest(): diff --git a/tests/functional_tests/transfer.py b/tests/functional_tests/transfer.py index fc582e618..b7a85f1d6 100755 --- a/tests/functional_tests/transfer.py +++ b/tests/functional_tests/transfer.py @@ -33,8 +33,8 @@ import time """Test simple transfers """ -from test_framework.daemon import Daemon -from test_framework.wallet import Wallet +from framework.daemon import Daemon +from framework.wallet import Wallet class TransferTest(): def run_test(self): diff --git a/tests/functional_tests/txpool.py b/tests/functional_tests/txpool.py index 419bd925c..71109c9e5 100755 --- a/tests/functional_tests/txpool.py +++ b/tests/functional_tests/txpool.py @@ -33,8 +33,8 @@ import time """Test txpool """ -from test_framework.daemon import Daemon -from test_framework.wallet import Wallet +from framework.daemon import Daemon +from framework.wallet import Wallet class TransferTest(): def run_test(self): diff --git a/tests/functional_tests/wallet_address.py b/tests/functional_tests/wallet_address.py index acd7b6821..66a1633ca 100755 --- a/tests/functional_tests/wallet_address.py +++ b/tests/functional_tests/wallet_address.py @@ -37,7 +37,7 @@ Test the following RPCs: """ -from test_framework.wallet import Wallet +from framework.wallet import Wallet class WalletAddressTest(): def run_test(self): diff --git a/tests/functional_tests/test_framework/__init__.py b/utils/python-rpc/framework/__init__.py similarity index 100% rename from tests/functional_tests/test_framework/__init__.py rename to utils/python-rpc/framework/__init__.py diff --git a/tests/functional_tests/test_framework/daemon.py b/utils/python-rpc/framework/daemon.py similarity index 100% rename from tests/functional_tests/test_framework/daemon.py rename to utils/python-rpc/framework/daemon.py diff --git a/tests/functional_tests/test_framework/rpc.py b/utils/python-rpc/framework/rpc.py similarity index 100% rename from tests/functional_tests/test_framework/rpc.py rename to utils/python-rpc/framework/rpc.py diff --git a/tests/functional_tests/test_framework/wallet.py b/utils/python-rpc/framework/wallet.py similarity index 100% rename from tests/functional_tests/test_framework/wallet.py rename to utils/python-rpc/framework/wallet.py