Skip to content

Commit fa389d4

Browse files
author
MarcoFalke
committed
[qa] Switch to py3
1 parent 3b9a0bf commit fa389d4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+504
-547
lines changed

.travis.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ matrix:
3737
- compiler: ": ARM"
3838
env: HOST=arm-linux-gnueabihf PACKAGES="g++-arm-linux-gnueabihf" DEP_OPTS="NO_QT=1" CHECK_DOC=1 GOAL="install" BITCOIN_CONFIG="--enable-glibc-back-compat --enable-reduce-exports"
3939
- compiler: ": Win32"
40-
env: HOST=i686-w64-mingw32 DPKG_ADD_ARCH="i386" DEP_OPTS="NO_QT=1" PACKAGES="nsis g++-mingw-w64-i686 wine1.6 bc" RUN_TESTS=true GOAL="install" BITCOIN_CONFIG="--enable-reduce-exports"
40+
env: HOST=i686-w64-mingw32 DPKG_ADD_ARCH="i386" DEP_OPTS="NO_QT=1" PACKAGES="python3 nsis g++-mingw-w64-i686 wine1.6 bc" RUN_TESTS=true GOAL="install" BITCOIN_CONFIG="--enable-reduce-exports"
4141
- compiler: ": 32-bit + dash"
42-
env: HOST=i686-pc-linux-gnu PACKAGES="g++-multilib bc python-zmq" DEP_OPTS="NO_QT=1" RUN_TESTS=true GOAL="install" BITCOIN_CONFIG="--enable-zmq --enable-glibc-back-compat --enable-reduce-exports LDFLAGS=-static-libstdc++" USE_SHELL="/bin/dash"
42+
env: HOST=i686-pc-linux-gnu PACKAGES="g++-multilib bc python3-zmq" DEP_OPTS="NO_QT=1" RUN_TESTS=true GOAL="install" BITCOIN_CONFIG="--enable-zmq --enable-glibc-back-compat --enable-reduce-exports LDFLAGS=-static-libstdc++" USE_SHELL="/bin/dash"
4343
- compiler: ": Win64"
44-
env: HOST=x86_64-w64-mingw32 DPKG_ADD_ARCH="i386" DEP_OPTS="NO_QT=1" PACKAGES="nsis g++-mingw-w64-x86-64 wine1.6 bc" RUN_TESTS=true GOAL="install" BITCOIN_CONFIG="--enable-reduce-exports"
44+
env: HOST=x86_64-w64-mingw32 DPKG_ADD_ARCH="i386" DEP_OPTS="NO_QT=1" PACKAGES="python3 nsis g++-mingw-w64-x86-64 wine1.6 bc" RUN_TESTS=true GOAL="install" BITCOIN_CONFIG="--enable-reduce-exports"
4545
- compiler: ": bitcoind"
46-
env: HOST=x86_64-unknown-linux-gnu PACKAGES="bc python-zmq" DEP_OPTS="NO_QT=1 NO_UPNP=1 DEBUG=1" RUN_TESTS=true GOAL="install" BITCOIN_CONFIG="--enable-zmq --enable-glibc-back-compat --enable-reduce-exports CPPFLAGS=-DDEBUG_LOCKORDER"
46+
env: HOST=x86_64-unknown-linux-gnu PACKAGES="bc python3-zmq" DEP_OPTS="NO_QT=1 NO_UPNP=1 DEBUG=1" RUN_TESTS=true GOAL="install" BITCOIN_CONFIG="--enable-zmq --enable-glibc-back-compat --enable-reduce-exports CPPFLAGS=-DDEBUG_LOCKORDER"
4747
- compiler: ": No wallet"
48-
env: HOST=x86_64-unknown-linux-gnu DEP_OPTS="NO_WALLET=1" RUN_TESTS=true GOAL="install" BITCOIN_CONFIG="--enable-glibc-back-compat --enable-reduce-exports"
48+
env: HOST=x86_64-unknown-linux-gnu PACKAGES="python3" DEP_OPTS="NO_WALLET=1" RUN_TESTS=true GOAL="install" BITCOIN_CONFIG="--enable-glibc-back-compat --enable-reduce-exports"
4949
- compiler: ": Cross-Mac"
5050
env: HOST=x86_64-apple-darwin11 PACKAGES="cmake imagemagick libcap-dev librsvg2-bin libz-dev libbz2-dev libtiff-tools python-dev" BITCOIN_CONFIG="--enable-reduce-exports" OSX_SDK=10.9 GOAL="deploy"
5151
exclude:

doc/zmq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ newer. Typically, it is packaged by distributions as something like
3838
*libzmq3-dev*. The C++ wrapper for ZeroMQ is *not* needed.
3939

4040
In order to run the example Python client scripts in contrib/ one must
41-
also install *python-zmq*, though this is not necessary for daemon
41+
also install *python3-zmq*, though this is not necessary for daemon
4242
operation.
4343

4444
## Enabling

qa/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ Before running the tests, the following must be installed.
1111

1212
Unix
1313
----
14-
The python-zmq library is required. On Ubuntu or Debian it can be installed via:
14+
The python3-zmq library is required. On Ubuntu or Debian it can be installed via:
1515
```
16-
sudo apt-get install python-zmq
16+
sudo apt-get install python3-zmq
1717
```
1818

1919
Running tests

qa/pull-tester/rpc-tests.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#!/usr/bin/env python2
2-
# Copyright (c) 2014-2015 The Bitcoin Core developers
1+
#!/usr/bin/env python3
2+
# Copyright (c) 2014-2016 The Bitcoin Core developers
33
# Distributed under the MIT software license, see the accompanying
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

@@ -70,14 +70,14 @@
7070
if EXEEXT == ".exe" and "-win" not in opts:
7171
# https://github.com/bitcoin/bitcoin/commit/d52802551752140cf41f0d9a225a43e84404d3e9
7272
# https://github.com/bitcoin/bitcoin/pull/5677#issuecomment-136646964
73-
print "Win tests currently disabled by default. Use -win option to enable"
73+
print("Win tests currently disabled by default. Use -win option to enable")
7474
sys.exit(0)
7575

7676
if not (ENABLE_WALLET == 1 and ENABLE_UTILS == 1 and ENABLE_BITCOIND == 1):
77-
print "No rpc tests to run. Wallet, utils, and bitcoind must all be enabled"
77+
print("No rpc tests to run. Wallet, utils, and bitcoind must all be enabled")
7878
sys.exit(0)
7979

80-
# python-zmq may not be installed. Handle this gracefully and with some helpful info
80+
# python3-zmq may not be installed. Handle this gracefully and with some helpful info
8181
if ENABLE_ZMQ:
8282
try:
8383
import zmq

qa/pull-tester/tests_config.py.in

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#!/usr/bin/env python2
2-
# Copyright (c) 2013-2014 The Bitcoin Core developers
1+
#!/usr/bin/env python3
2+
# Copyright (c) 2013-2016 The Bitcoin Core developers
33
# Distributed under the MIT software license, see the accompanying
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

@@ -11,5 +11,3 @@ EXEEXT="@EXEEXT@"
1111
@BUILD_BITCOIN_UTILS_TRUE@ENABLE_UTILS=1
1212
@BUILD_BITCOIND_TRUE@ENABLE_BITCOIND=1
1313
@ENABLE_ZMQ_TRUE@ENABLE_ZMQ=1
14-
15-

qa/rpc-tests/abandonconflict.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
#!/usr/bin/env python2
2-
# Copyright (c) 2014-2015 The Bitcoin Core developers
1+
#!/usr/bin/env python3
2+
# Copyright (c) 2014-2016 The Bitcoin Core developers
33
# Distributed under the MIT software license, see the accompanying
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

66

77
from test_framework.test_framework import BitcoinTestFramework
88
from test_framework.util import *
9-
try:
10-
import urllib.parse as urlparse
11-
except ImportError:
12-
import urlparse
9+
import urllib.parse
1310

1411
class AbandonConflictTest(BitcoinTestFramework):
1512

@@ -34,7 +31,7 @@ def run_test(self):
3431
assert(balance - newbalance < Decimal("0.001")) #no more than fees lost
3532
balance = newbalance
3633

37-
url = urlparse.urlparse(self.nodes[1].url)
34+
url = urllib.parse.urlparse(self.nodes[1].url)
3835
self.nodes[0].disconnectnode(url.hostname+":"+str(p2p_port(1)))
3936

4037
# Identify the 10btc outputs
@@ -151,9 +148,9 @@ def run_test(self):
151148
self.nodes[0].invalidateblock(self.nodes[0].getbestblockhash())
152149
newbalance = self.nodes[0].getbalance()
153150
#assert(newbalance == balance - Decimal("10"))
154-
print "If balance has not declined after invalidateblock then out of mempool wallet tx which is no longer"
155-
print "conflicted has not resumed causing its inputs to be seen as spent. See Issue #7315"
156-
print balance , " -> " , newbalance , " ?"
151+
print("If balance has not declined after invalidateblock then out of mempool wallet tx which is no longer")
152+
print("conflicted has not resumed causing its inputs to be seen as spent. See Issue #7315")
153+
print(str(balance) + " -> " + str(newbalance) + " ?")
157154

158155
if __name__ == '__main__':
159156
AbandonConflictTest().main()

qa/rpc-tests/bip65-cltv-p2p.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
#!/usr/bin/env python2
2-
# Copyright (c) 2015 The Bitcoin Core developers
3-
# Distributed under the MIT/X11 software license, see the accompanying
1+
#!/usr/bin/env python3
2+
# Copyright (c) 2015-2016 The Bitcoin Core developers
3+
# Distributed under the MIT software license, see the accompanying
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
5-
#
65

76
from test_framework.test_framework import ComparisonTestFramework
87
from test_framework.util import *
@@ -67,13 +66,13 @@ def get_tests(self):
6766

6867
self.coinbase_blocks = self.nodes[0].generate(2)
6968
height = 3 # height of the next block to build
70-
self.tip = int ("0x" + self.nodes[0].getbestblockhash() + "L", 0)
69+
self.tip = int("0x" + self.nodes[0].getbestblockhash(), 0)
7170
self.nodeaddress = self.nodes[0].getnewaddress()
7271
self.last_block_time = int(time.time())
7372

7473
''' 98 more version 3 blocks '''
7574
test_blocks = []
76-
for i in xrange(98):
75+
for i in range(98):
7776
block = create_block(self.tip, create_coinbase(height), self.last_block_time + 1)
7877
block.nVersion = 3
7978
block.rehash()
@@ -86,7 +85,7 @@ def get_tests(self):
8685

8786
''' Mine 749 version 4 blocks '''
8887
test_blocks = []
89-
for i in xrange(749):
88+
for i in range(749):
9089
block = create_block(self.tip, create_coinbase(height), self.last_block_time + 1)
9190
block.nVersion = 4
9291
block.rehash()
@@ -138,7 +137,7 @@ def get_tests(self):
138137

139138
''' Mine 199 new version blocks on last valid tip '''
140139
test_blocks = []
141-
for i in xrange(199):
140+
for i in range(199):
142141
block = create_block(self.tip, create_coinbase(height), self.last_block_time + 1)
143142
block.nVersion = 4
144143
block.rehash()

qa/rpc-tests/bip65-cltv.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#!/usr/bin/env python2
2-
# Copyright (c) 2015 The Bitcoin Core developers
1+
#!/usr/bin/env python3
2+
# Copyright (c) 2015-2016 The Bitcoin Core developers
33
# Distributed under the MIT software license, see the accompanying
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

@@ -32,7 +32,7 @@ def run_test(self):
3232
raise AssertionError("Failed to mine 100 version=3 blocks")
3333

3434
# Mine 750 new-version blocks
35-
for i in xrange(15):
35+
for i in range(15):
3636
self.nodes[2].generate(50)
3737
self.sync_all()
3838
if (self.nodes[0].getblockcount() != cnt + 850):
@@ -49,7 +49,7 @@ def run_test(self):
4949
# TODO: check that new CHECKLOCKTIMEVERIFY rules are enforced
5050

5151
# Mine 198 new-version blocks
52-
for i in xrange(2):
52+
for i in range(2):
5353
self.nodes[2].generate(99)
5454
self.sync_all()
5555
if (self.nodes[0].getblockcount() != cnt + 1049):

0 commit comments

Comments
 (0)