diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-05-29 11:45:25 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-09-17 11:38:33 +0000 |
commit | 6b72541dc01de559d5d09daffb4cf2578bb27067 (patch) | |
tree | b987ecb8325e90f05775be9c3205a08b7c7d6f8f | |
parent | functional_tests: pop exactly what we need to test before testing (diff) | |
download | monero-6b72541dc01de559d5d09daffb4cf2578bb27067.tar.xz |
functional_tests: python3 compatibility
and add missing tests
-rwxr-xr-x | tests/functional_tests/address_book.py | 5 | ||||
-rwxr-xr-x | tests/functional_tests/functional_tests_rpc.py | 4 | ||||
-rwxr-xr-x | tests/functional_tests/mining.py | 2 | ||||
-rwxr-xr-x | tests/functional_tests/speed.py | 2 | ||||
-rwxr-xr-x | tests/functional_tests/transfer.py | 2 | ||||
-rwxr-xr-x | tests/functional_tests/validate_address.py | 3 | ||||
-rwxr-xr-x | tests/functional_tests/wallet.py | 12 |
7 files changed, 15 insertions, 15 deletions
diff --git a/tests/functional_tests/address_book.py b/tests/functional_tests/address_book.py index e6c57896b..8d8711ffc 100755 --- a/tests/functional_tests/address_book.py +++ b/tests/functional_tests/address_book.py @@ -32,6 +32,7 @@ """Test wallet address book RPC """ +from __future__ import print_function from framework.wallet import Wallet class AddressBookTest(): @@ -40,7 +41,7 @@ class AddressBookTest(): self.test_address_book() def create(self): - print 'Creating wallet' + print('Creating wallet') wallet = Wallet() # close the wallet if any, will throw if none is loaded try: wallet.close_wallet() @@ -51,7 +52,7 @@ class AddressBookTest(): assert res.seed == seed def test_address_book(self): - print 'Testing address book' + print('Testing address book') wallet = Wallet() # empty at start diff --git a/tests/functional_tests/functional_tests_rpc.py b/tests/functional_tests/functional_tests_rpc.py index 65702f271..b0954b921 100755 --- a/tests/functional_tests/functional_tests_rpc.py +++ b/tests/functional_tests/functional_tests_rpc.py @@ -10,7 +10,7 @@ import string import os USAGE = 'usage: functional_tests_rpc.py <python> <srcdir> <builddir> [<tests-to-run> | all]' -DEFAULT_TESTS = ['bans', 'daemon_info', 'blockchain', 'wallet', 'integrated_address', 'mining', 'transfer', 'txpool', 'multisig', 'cold_signing', 'sign_message', 'proofs', 'get_output_distribution', 'address_book', 'uri'] +DEFAULT_TESTS = ['address_book', 'bans', 'blockchain', 'cold_signing', 'daemon_info', 'get_output_distribution', 'integrated_address', 'mining', 'multisig', 'proofs', 'sign_message', 'transfer', 'txpool', 'uri', 'validate_address', 'wallet'] try: python = sys.argv[1] srcdir = sys.argv[2] @@ -135,6 +135,6 @@ else: if len(FAIL) == 0: print('Done, ' + str(len(PASS)) + '/' + str(len(tests)) + ' tests passed') else: - print('Done, ' + str(len(FAIL)) + '/' + str(len(tests)) + ' tests failed: ' + string.join(FAIL, ', ')) + print('Done, ' + str(len(FAIL)) + '/' + str(len(tests)) + ' tests failed: ' + ', '.join(FAIL)) sys.exit(0 if len(FAIL) == 0 else 1) diff --git a/tests/functional_tests/mining.py b/tests/functional_tests/mining.py index f1b91e8fc..a08a45ad4 100755 --- a/tests/functional_tests/mining.py +++ b/tests/functional_tests/mining.py @@ -143,7 +143,7 @@ class MiningTest(): assert res_status.active == False def submitblock(self): - print "Test submitblock" + print("Test submitblock") daemon = Daemon() res = daemon.get_height() diff --git a/tests/functional_tests/speed.py b/tests/functional_tests/speed.py index 591c98ec1..71be785b8 100755 --- a/tests/functional_tests/speed.py +++ b/tests/functional_tests/speed.py @@ -48,7 +48,7 @@ from framework.wallet import Wallet class SpeedTest(): def reset(self): - print 'Resetting blockchain' + print('Resetting blockchain') daemon = Daemon() res = daemon.get_height() daemon.pop_blocks(res.height - 1) diff --git a/tests/functional_tests/transfer.py b/tests/functional_tests/transfer.py index 9cb03741f..b4264f72d 100755 --- a/tests/functional_tests/transfer.py +++ b/tests/functional_tests/transfer.py @@ -792,7 +792,7 @@ class TransferTest(): if not k in unrecoverable_fields: e[k] = x[k] new_t_out.append(e) - assert sorted(old_t_out) == sorted(new_t_out) + assert sorted(old_t_out, key = lambda k: k['txid']) == sorted(new_t_out, key = lambda k: k['txid']) def check_is_key_image_spent(self): daemon = Daemon() diff --git a/tests/functional_tests/validate_address.py b/tests/functional_tests/validate_address.py index 58748b0a2..7c3d8abfa 100755 --- a/tests/functional_tests/validate_address.py +++ b/tests/functional_tests/validate_address.py @@ -28,11 +28,10 @@ # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -import time - """Test address validation RPC calls """ +from __future__ import print_function from framework.wallet import Wallet class AddressValidationTest(): diff --git a/tests/functional_tests/wallet.py b/tests/functional_tests/wallet.py index 85f6a4955..ddf88f5ef 100755 --- a/tests/functional_tests/wallet.py +++ b/tests/functional_tests/wallet.py @@ -58,7 +58,7 @@ class WalletTest(): assert WALLET_DIRECTORY != '' try: os.unlink(WALLET_DIRECTORY + '/' + name) - except OSError, e: + except OSError as e: if e.errno != errno.ENOENT: raise @@ -183,7 +183,7 @@ class WalletTest(): res = wallet.label_account(0, "main") def tags(self): - print 'Testing tags' + print('Testing tags') wallet = Wallet() res = wallet.get_account_tags() assert not 'account_tags' in res or len(res.account_tags) == 0 @@ -256,7 +256,7 @@ class WalletTest(): assert sorted(subaddress_accounts) == [(0, '42ey1afDFnn4886T7196doS9GPMzexD9gXpsZJDwVjeRVdFCSoHnv7KPbBeGpzJBzHRCAs9UxqeoyFQMYbqSWYTfJJQAWDm', 'main'), (1, '82pP87g1Vkd3LUMssBCumk3MfyEsFqLAaGDf6oxddu61EgSFzt8gCwUD4tr3kp9TUfdPs2CnpD7xLZzyC1Ei9UsW3oyCWDf', 'idx1_new')] def attributes(self): - print 'Testing attributes' + print('Testing attributes') wallet = Wallet() ok = False @@ -319,13 +319,13 @@ class WalletTest(): languages = res.languages languages_local = res.languages_local for language in languages + languages_local: - print('Creating ' + language.encode('utf8') + ' wallet') + print('Creating ' + language + ' wallet') wallet.create_wallet(filename = '', language = language) res = wallet.query_key('mnemonic') wallet.close_wallet() def change_password(self): - print 'Testing password change' + print('Testing password change') wallet = Wallet() # close the wallet if any, will throw if none is loaded @@ -359,7 +359,7 @@ class WalletTest(): self.remove_wallet_files('test1') def store(self): - print 'Testing store' + print('Testing store') wallet = Wallet() # close the wallet if any, will throw if none is loaded |