unit test fixes and reducing support for py2

This commit is contained in:
Lex Berezhny 2018-07-04 20:43:25 -04:00
parent 6bb81e4d6f
commit c3cb297205
7 changed files with 15 additions and 15 deletions

View file

@ -1,7 +1,6 @@
language: python
python:
- "2.7"
- "3.6"
install:

View file

@ -18,7 +18,6 @@ setup(
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Operating System :: OS Independent',
'Topic :: Internet',

View file

@ -11,7 +11,7 @@ class TestWalletCreation(unittest.TestCase):
def setUp(self):
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.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):
wallet_dict = {
'version': 1,
'name': 'Main Wallet',
'accounts': [
{
@ -61,11 +62,11 @@ class TestWalletCreation(unittest.TestCase):
def test_read_write(self):
manager = WalletManager()
config = {'wallet_path': '/tmp/wallet'}
config = {'data_path': '/tmp/wallet'}
ledger = manager.get_or_create_ledger(BTCLedger.get_id(), config)
with tempfile.NamedTemporaryFile(suffix='.json') as wallet_file:
wallet_file.write(b'{}')
wallet_file.write(b'{"version": 1}')
wallet_file.seek(0)
# create and write wallet to a file

View file

@ -64,7 +64,7 @@ class KeyChain:
defer.returnValue(addresses[0])
class BaseAccount:
class BaseAccount(object):
mnemonic_class = Mnemonic
private_key_class = PrivateKey

View file

@ -109,7 +109,7 @@ class BaseLedger(six.with_metaclass(LedgerRegistry)):
@property
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):
""" Fee based on size of the input / output. """

View file

@ -44,6 +44,7 @@ class Wallet:
def to_dict(self):
return {
'version': WalletStorage.LATEST_VERSION,
'name': self.name,
'accounts': [a.to_dict() for a in self.accounts]
}

16
tox.ini
View file

@ -1,16 +1,16 @@
[tox]
#envlist = py{27,36}-unit,py36-integration-{torba.coin.bitcoincash,torba.coin.bitcoinsegwit}
envlist = py{27,36}-unit,py36-integration-torba.coin.bitcoinsegwit
#envlist = unit,integration-{torba.coin.bitcoincash,torba.coin.bitcoinsegwit}
envlist = unit,integration-torba.coin.bitcoinsegwit
[testenv]
deps =
coverage
py36-integration: ../orchstr8
py36-integration: ../electrumx
integration: ../orchstr8
integration: ../electrumx
extras = test
changedir = {toxinidir}/tests
setenv = py36-integration: LEDGER={envname}
setenv = integration: LEDGER={envname}
commands =
py{27,36}-unit: coverage run -p --source={envsitepackagesdir}/torba -m twisted.trial unit
py36-integration: orchstr8 download
py36-integration: coverage run -p --source={envsitepackagesdir}/torba -m twisted.trial --reactor=asyncio integration
unit: coverage run -p --source={envsitepackagesdir}/torba -m twisted.trial unit
integration: orchstr8 download
integration: coverage run -p --source={envsitepackagesdir}/torba -m twisted.trial --reactor=asyncio integration