unit test fixes and reducing support for py2
This commit is contained in:
parent
6bb81e4d6f
commit
c3cb297205
7 changed files with 15 additions and 15 deletions
|
@ -1,7 +1,6 @@
|
||||||
language: python
|
language: python
|
||||||
|
|
||||||
python:
|
python:
|
||||||
- "2.7"
|
|
||||||
- "3.6"
|
- "3.6"
|
||||||
|
|
||||||
install:
|
install:
|
||||||
|
|
1
setup.py
1
setup.py
|
@ -18,7 +18,6 @@ setup(
|
||||||
'Intended Audience :: Developers',
|
'Intended Audience :: Developers',
|
||||||
'Intended Audience :: System Administrators',
|
'Intended Audience :: System Administrators',
|
||||||
'License :: OSI Approved :: MIT License',
|
'License :: OSI Approved :: MIT License',
|
||||||
'Programming Language :: Python :: 2.7',
|
|
||||||
'Programming Language :: Python :: 3',
|
'Programming Language :: Python :: 3',
|
||||||
'Operating System :: OS Independent',
|
'Operating System :: OS Independent',
|
||||||
'Topic :: Internet',
|
'Topic :: Internet',
|
||||||
|
|
|
@ -11,7 +11,7 @@ class TestWalletCreation(unittest.TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.manager = WalletManager()
|
self.manager = WalletManager()
|
||||||
config = {'wallet_path': '/tmp/wallet'}
|
config = {'data_path': '/tmp/wallet'}
|
||||||
self.btc_ledger = self.manager.get_or_create_ledger(BTCLedger.get_id(), config)
|
self.btc_ledger = self.manager.get_or_create_ledger(BTCLedger.get_id(), config)
|
||||||
self.bch_ledger = self.manager.get_or_create_ledger(BCHLedger.get_id(), config)
|
self.bch_ledger = self.manager.get_or_create_ledger(BCHLedger.get_id(), config)
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ class TestWalletCreation(unittest.TestCase):
|
||||||
|
|
||||||
def test_load_and_save_wallet(self):
|
def test_load_and_save_wallet(self):
|
||||||
wallet_dict = {
|
wallet_dict = {
|
||||||
|
'version': 1,
|
||||||
'name': 'Main Wallet',
|
'name': 'Main Wallet',
|
||||||
'accounts': [
|
'accounts': [
|
||||||
{
|
{
|
||||||
|
@ -61,11 +62,11 @@ class TestWalletCreation(unittest.TestCase):
|
||||||
|
|
||||||
def test_read_write(self):
|
def test_read_write(self):
|
||||||
manager = WalletManager()
|
manager = WalletManager()
|
||||||
config = {'wallet_path': '/tmp/wallet'}
|
config = {'data_path': '/tmp/wallet'}
|
||||||
ledger = manager.get_or_create_ledger(BTCLedger.get_id(), config)
|
ledger = manager.get_or_create_ledger(BTCLedger.get_id(), config)
|
||||||
|
|
||||||
with tempfile.NamedTemporaryFile(suffix='.json') as wallet_file:
|
with tempfile.NamedTemporaryFile(suffix='.json') as wallet_file:
|
||||||
wallet_file.write(b'{}')
|
wallet_file.write(b'{"version": 1}')
|
||||||
wallet_file.seek(0)
|
wallet_file.seek(0)
|
||||||
|
|
||||||
# create and write wallet to a file
|
# create and write wallet to a file
|
||||||
|
|
|
@ -64,7 +64,7 @@ class KeyChain:
|
||||||
defer.returnValue(addresses[0])
|
defer.returnValue(addresses[0])
|
||||||
|
|
||||||
|
|
||||||
class BaseAccount:
|
class BaseAccount(object):
|
||||||
|
|
||||||
mnemonic_class = Mnemonic
|
mnemonic_class = Mnemonic
|
||||||
private_key_class = PrivateKey
|
private_key_class = PrivateKey
|
||||||
|
|
|
@ -109,7 +109,7 @@ class BaseLedger(six.with_metaclass(LedgerRegistry)):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def path(self):
|
def path(self):
|
||||||
return os.path.join(self.config['wallet_path'], self.get_id())
|
return os.path.join(self.config['data_path'], self.get_id())
|
||||||
|
|
||||||
def get_input_output_fee(self, io):
|
def get_input_output_fee(self, io):
|
||||||
""" Fee based on size of the input / output. """
|
""" Fee based on size of the input / output. """
|
||||||
|
|
|
@ -44,6 +44,7 @@ class Wallet:
|
||||||
|
|
||||||
def to_dict(self):
|
def to_dict(self):
|
||||||
return {
|
return {
|
||||||
|
'version': WalletStorage.LATEST_VERSION,
|
||||||
'name': self.name,
|
'name': self.name,
|
||||||
'accounts': [a.to_dict() for a in self.accounts]
|
'accounts': [a.to_dict() for a in self.accounts]
|
||||||
}
|
}
|
||||||
|
|
16
tox.ini
16
tox.ini
|
@ -1,16 +1,16 @@
|
||||||
[tox]
|
[tox]
|
||||||
#envlist = py{27,36}-unit,py36-integration-{torba.coin.bitcoincash,torba.coin.bitcoinsegwit}
|
#envlist = unit,integration-{torba.coin.bitcoincash,torba.coin.bitcoinsegwit}
|
||||||
envlist = py{27,36}-unit,py36-integration-torba.coin.bitcoinsegwit
|
envlist = unit,integration-torba.coin.bitcoinsegwit
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
deps =
|
deps =
|
||||||
coverage
|
coverage
|
||||||
py36-integration: ../orchstr8
|
integration: ../orchstr8
|
||||||
py36-integration: ../electrumx
|
integration: ../electrumx
|
||||||
extras = test
|
extras = test
|
||||||
changedir = {toxinidir}/tests
|
changedir = {toxinidir}/tests
|
||||||
setenv = py36-integration: LEDGER={envname}
|
setenv = integration: LEDGER={envname}
|
||||||
commands =
|
commands =
|
||||||
py{27,36}-unit: coverage run -p --source={envsitepackagesdir}/torba -m twisted.trial unit
|
unit: coverage run -p --source={envsitepackagesdir}/torba -m twisted.trial unit
|
||||||
py36-integration: orchstr8 download
|
integration: orchstr8 download
|
||||||
py36-integration: coverage run -p --source={envsitepackagesdir}/torba -m twisted.trial --reactor=asyncio integration
|
integration: coverage run -p --source={envsitepackagesdir}/torba -m twisted.trial --reactor=asyncio integration
|
||||||
|
|
Loading…
Add table
Reference in a new issue