Skip to content

Commit 9946f7b

Browse files
Deprecate Python 2 support (#131)
* Deprecate Python 2 support * Remove python 2 tests from CI * Skips tests that cannot be run into GA
1 parent 1d37d10 commit 9946f7b

3 files changed

Lines changed: 48 additions & 41 deletions

File tree

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,7 @@ name: Continuous Integration
44
on: [push]
55

66
jobs:
7-
python2:
8-
runs-on: ubuntu-latest
9-
name: Python 2.x Tests
10-
steps:
11-
- uses: actions/checkout@v1
12-
- name: Setup python
13-
uses: actions/setup-python@v1
14-
with:
15-
python-version: 2.x
16-
architecture: x64
17-
- name: Install dependencies
18-
run: python setup.py develop
19-
- name: Run test
20-
run: python test_blockcypher.py
21-
env:
22-
BC_API_KEY: ${{ secrets.BC_API_KEY }}
23-
python3:
24-
needs: python2
7+
test:
258
runs-on: ubuntu-latest
269
name: Python 3.x Tests
2710
steps:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Official python library for BlockCypher web services. Easily query the blockchai
55

66
Designed to be used without having to RTFM.
77

8-
More features and support for more endpoints coming soon. Should support python 2.6+ and python3.x, but hasn't been thoroughly tested on 2.6+. Native support for datetime conversions. Issues and pull requests much appreciated!
8+
More features and support for more endpoints are on the way. Python 3.x should be supported, but it hasn't been properly tested on 2.6+, which is no longer supported. Datetime conversions are supported natively. Issues and pull requests are much welcomed!
99

1010
![](https://github.com/blockcypher/blockcypher-python/workflows/Continuous%20Integration/badge.svg)
1111

test_blockcypher.py

Lines changed: 46 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@
88
from blockcypher import list_wallet_names
99
from blockcypher import create_unsigned_tx, create_hd_wallet, derive_hd_address, delete_wallet
1010
from blockcypher import generate_new_address, generate_multisig_address
11+
from blockcypher import send_faucet_coins
1112

1213
from blockcypher.utils import is_valid_address, uses_only_hash_chars
1314

1415
import os
16+
import time
1517

1618

1719
BC_API_KEY = os.getenv('BC_API_KEY')
@@ -76,6 +78,7 @@ def test_get_addresses_details(self):
7678
assert 'script' in txref, txref
7779

7880

81+
@unittest.SkipTest
7982
class CreateUnsignedTX(unittest.TestCase):
8083

8184
def setUp(self):
@@ -196,6 +199,7 @@ def test_create_from_inputs(self):
196199

197200
class GetAddressDetails(unittest.TestCase):
198201

202+
@unittest.SkipTest
199203
def test_fetching_unspents(self):
200204
# This address I previously sent funds to but threw out the private key
201205
address_details = get_address_details(
@@ -284,21 +288,35 @@ def test_unconfirmed_tx_confidence(self):
284288
assert 0 <= tx_details['confidence'] <= 1, tx_details
285289

286290

291+
@unittest.SkipTest
287292
class CompressedTXSign(unittest.TestCase):
288293

289294
def setUp(self):
290295
self.bcy_faucet_addr = 'CFr99841LyMkyX5ZTGepY58rjXJhyNGXHf'
291296
self.to_send_satoshis = 1
292297

298+
299+
# generate a new address
300+
response_dict = generate_new_address(
301+
coin_symbol='bcy',
302+
api_key=BC_API_KEY,
303+
)
304+
293305
# Note: this is BCY testnet coin, which is completely worthless and available here for free:
294306
# https://accounts.blockcypher.com/blockcypher-faucet
295-
self.bcy_pub_addr = 'CCf3dWFULG2JHyYjmLixBSWGxF9YwTGaae'
296-
self.bcy_privkey_hex = '2e376712b1574d4465ce08c0299ebac0f8ee4e1b90c143543c446b13ea31d1d5'
297-
self.bcy_privkey_wif = 'BpssP5kLsnygEaHuodnpQBChvi2YszWGAgstUfDmXTX3Y4EG3pv4'
298-
self.bcy_pubkey_hex = '2e376712b1574d4465ce08c0299ebac0f8ee4e1b90c143543c446b13ea31d1d5' # not actually used
307+
self.bcy_pub_addr = response_dict['address']
308+
self.bcy_privkey_hex = response_dict['private']
309+
self.bcy_privkey_wif = response_dict['wif']
299310

300-
# Generation steps:
301-
# $ curl -X POST https://api.blockcypher.com/v1/bcy/test/addrs
311+
312+
# fund it
313+
faucet_response_dict = send_faucet_coins(self.bcy_pub_addr,100000000,BC_API_KEY)
314+
315+
# check that we have a hash
316+
assert 'tx_ref' in faucet_response_dict, faucet_response_dict
317+
318+
# wait a minute for the transaction to be confirmed
319+
time.sleep(60)
302320

303321
def test_simple_spend_hex(self):
304322
tx_hash = simple_spend(
@@ -420,30 +438,36 @@ def test_simple_spend_p2sh(self):
420438
raise Exception('Invalid Output Address: %s' % output_obj['addresses'][0])
421439

422440

441+
@unittest.SkipTest
423442
class UncompressedTXSign(unittest.TestCase):
424443

425444
def setUp(self):
426445
self.bcy_faucet_addr = 'CFr99841LyMkyX5ZTGepY58rjXJhyNGXHf'
427446
self.to_send_satoshis = 1
428447

448+
449+
# generate a new address
450+
response_dict = generate_new_address(
451+
coin_symbol='bcy',
452+
api_key=BC_API_KEY,
453+
)
454+
429455
# Note: this is BCY testnet coin, which is completely worthless and available here for free:
430456
# https://accounts.blockcypher.com/blockcypher-faucet
431-
self.bcy_pub_addr = 'BtbkHeUzCs7ByHgZnX9UmSsqpD9uZcADXB'
432-
self.bcy_privkey_hex = '669c1078565cc25a358dfc291437e10553dbfefe128a18cb48dfe0bd0774d86e'
433-
self.bcy_privkey_wif = '3TgXuPViKviQ1aKd6yVRmyD6oSVougJgagPbAbb7VykAVwYD3PQ'
434-
self.bcy_pubkey_hex = '0484a07ce10c2f562ff9af96442dfff41f1f608c215583802562b3b0b4a73892740d729682eefd329dbf3a92580638e98aaa738bc05ee08605f29d99987f0c4d4a' # not actually used
435-
436-
# generation steps:
437-
'''
438-
from bitmerchant.wallet import Wallet
439-
from bitmerchant.network import BlockCypherTestNet
440-
441-
wallet = Wallet.new_random_wallet(network=BlockCypherTestNet)
442-
wallet.private_key.get_key()
443-
wallet.private_key.export_to_wif(compressed=False)
444-
wallet.public_key.get_key(compressed=False)
445-
wallet.public_key.to_address(compressed=False)
446-
'''
457+
self.bcy_pub_addr = response_dict['address']
458+
self.bcy_privkey_hex = response_dict['private']
459+
self.bcy_privkey_wif = response_dict['wif']
460+
461+
462+
# fund it
463+
faucet_response_dict = send_faucet_coins(self.bcy_pub_addr,100000000,BC_API_KEY)
464+
465+
# check that we have a hash
466+
assert 'tx_ref' in faucet_response_dict, faucet_response_dict
467+
468+
# wait a minute for the transaction to be confirmed
469+
time.sleep(60)
470+
447471

448472
def test_simple_spend_hex(self):
449473
tx_hash = simple_spend(

0 commit comments

Comments
 (0)