diff --git a/.travis.yml b/.travis.yml index a64cbcb35..750950345 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,11 +20,9 @@ jobs: name: "Unit Tests w/ Python 3.7" install: - pip install coverage - - pip install git+https://github.com/lbryio/electrumx.git#lbryumx - - pip install git+https://github.com/lbryio/orchstr8.git - pip install git+https://github.com/lbryio/lbryschema.git - - pip install git+https://github.com/lbryio/lbryumx.git - pip install git+https://github.com/lbryio/torba.git + - pip install git+https://github.com/lbryio/lbryumx.git#latest_rebased - pip install -e .[test] script: - HOME=/tmp coverage run -p --source=lbrynet -m unittest discover -v tests.unit.wallet @@ -49,11 +47,9 @@ jobs: - name: "Integration Tests" install: - pip install tox-travis coverage - - pushd .. && git clone https://github.com/lbryio/electrumx.git --branch lbryumx && popd - - pushd .. && git clone https://github.com/lbryio/orchstr8.git && popd - pushd .. && git clone https://github.com/lbryio/lbryschema.git && popd - - pushd .. && git clone https://github.com/lbryio/lbryumx.git && cd lbryumx && git checkout afd34f323dd94c516108a65240f7d17aea8efe85 && cd .. && popd - pushd .. && git clone https://github.com/lbryio/torba.git && popd + - pushd .. && git clone https://github.com/lbryio/lbryumx.git && cd lbryumx && git checkout latest_rebased && cd .. && popd script: tox after_success: - coverage combine tests/ diff --git a/lbrynet/daemon/ComponentManager.py b/lbrynet/daemon/ComponentManager.py index c35b43a64..c263feaed 100644 --- a/lbrynet/daemon/ComponentManager.py +++ b/lbrynet/daemon/ComponentManager.py @@ -60,7 +60,8 @@ class ComponentManager: try: component = self.get_component(condition.component) result = condition.evaluate(component) - except Exception as err: + except Exception: + log.exception('failed to evaluate condition:') result = False return result, "" if result else condition.message diff --git a/lbrynet/daemon/Daemon.py b/lbrynet/daemon/Daemon.py index ddc15251d..1b4953526 100644 --- a/lbrynet/daemon/Daemon.py +++ b/lbrynet/daemon/Daemon.py @@ -14,8 +14,8 @@ from twisted.internet import defer, reactor from twisted.internet.task import LoopingCall from twisted.python.failure import Failure -from torba.constants import COIN -from torba.baseaccount import SingleKey, HierarchicalDeterministic +from torba.client.constants import COIN +from torba.client.baseaccount import SingleKey, HierarchicalDeterministic from lbryschema.claim import ClaimDict from lbryschema.uri import parse_lbry_uri diff --git a/lbrynet/daemon/Downloader.py b/lbrynet/daemon/Downloader.py index 7d5b197de..f9b6b38d9 100644 --- a/lbrynet/daemon/Downloader.py +++ b/lbrynet/daemon/Downloader.py @@ -12,7 +12,7 @@ from lbrynet.core.utils import safe_start_looping_call, safe_stop_looping_call from lbrynet.core.StreamDescriptor import download_sd_blob from lbrynet.file_manager.EncryptedFileDownloader import ManagedEncryptedFileDownloaderFactory from lbrynet import conf -from torba.constants import COIN +from torba.client.constants import COIN from lbrynet.wallet.dewies import dewies_to_lbc INITIALIZING_CODE = 'initializing' diff --git a/lbrynet/database/storage.py b/lbrynet/database/storage.py index 56643d0de..4e931238a 100644 --- a/lbrynet/database/storage.py +++ b/lbrynet/database/storage.py @@ -12,7 +12,7 @@ from lbryschema.decode import smart_decode from lbrynet import conf from lbrynet.cryptstream.CryptBlob import CryptBlobInfo from lbrynet.dht.constants import dataExpireTimeout -from torba.constants import COIN +from torba.client.constants import COIN log = logging.getLogger(__name__) diff --git a/lbrynet/wallet/__init__.py b/lbrynet/wallet/__init__.py index 5ed03cc18..c5c28f11a 100644 --- a/lbrynet/wallet/__init__.py +++ b/lbrynet/wallet/__init__.py @@ -4,6 +4,6 @@ __node_bin__ = '' __node_url__ = ( 'https://github.com/lbryio/lbrycrd/releases/download/v0.12.2.1/lbrycrd-linux.zip' ) -__electrumx__ = 'lbryumx.coin.LBCRegTest' +__spvserver__ = 'lbryumx.coin.LBCRegTest' from .ledger import MainNetLedger, RegTestLedger diff --git a/lbrynet/wallet/account.py b/lbrynet/wallet/account.py index 97988955e..3640a8f47 100644 --- a/lbrynet/wallet/account.py +++ b/lbrynet/wallet/account.py @@ -1,8 +1,8 @@ import json import logging -from torba.baseaccount import BaseAccount -from torba.basetransaction import TXORef +from torba.client.baseaccount import BaseAccount +from torba.client.basetransaction import TXORef from lbryschema.claim import ClaimDict from lbryschema.signer import SECP256k1, get_signer diff --git a/lbrynet/wallet/claim_proofs.py b/lbrynet/wallet/claim_proofs.py index f84ac487b..77beafa16 100644 --- a/lbrynet/wallet/claim_proofs.py +++ b/lbrynet/wallet/claim_proofs.py @@ -1,7 +1,7 @@ import six import struct import binascii -from torba.hash import double_sha256 +from torba.client.hash import double_sha256 class InvalidProofError(Exception): diff --git a/lbrynet/wallet/database.py b/lbrynet/wallet/database.py index 3afe2f0d2..5430d0c82 100644 --- a/lbrynet/wallet/database.py +++ b/lbrynet/wallet/database.py @@ -1,4 +1,4 @@ -from torba.basedatabase import BaseDatabase +from torba.client.basedatabase import BaseDatabase class WalletDatabase(BaseDatabase): diff --git a/lbrynet/wallet/dewies.py b/lbrynet/wallet/dewies.py index 20bfddecf..c8cec21fa 100644 --- a/lbrynet/wallet/dewies.py +++ b/lbrynet/wallet/dewies.py @@ -1,6 +1,6 @@ import re import textwrap -from torba.constants import COIN +from torba.client.constants import COIN def lbc_to_dewies(lbc): diff --git a/lbrynet/wallet/header.py b/lbrynet/wallet/header.py index 9daeafc5b..6ef0f0213 100644 --- a/lbrynet/wallet/header.py +++ b/lbrynet/wallet/header.py @@ -2,9 +2,9 @@ import struct from typing import Optional from binascii import hexlify, unhexlify -from torba.baseheader import BaseHeaders -from torba.util import ArithUint256 -from torba.hash import sha512, double_sha256, ripemd160 +from torba.client.baseheader import BaseHeaders +from torba.client.util import ArithUint256 +from torba.client.hash import sha512, double_sha256, ripemd160 class Headers(BaseHeaders): diff --git a/lbrynet/wallet/ledger.py b/lbrynet/wallet/ledger.py index 992a43e7e..d9dfb591d 100644 --- a/lbrynet/wallet/ledger.py +++ b/lbrynet/wallet/ledger.py @@ -4,7 +4,7 @@ from binascii import unhexlify from lbryschema.error import URIParseError from lbryschema.uri import parse_lbry_uri -from torba.baseledger import BaseLedger +from torba.client.baseledger import BaseLedger from .resolve import Resolver from .account import Account diff --git a/lbrynet/wallet/manager.py b/lbrynet/wallet/manager.py index 1c73991b4..ef1f4e172 100644 --- a/lbrynet/wallet/manager.py +++ b/lbrynet/wallet/manager.py @@ -10,7 +10,7 @@ from typing import Optional from twisted.internet import defer from lbryschema.schema import SECP256k1 -from torba.basemanager import BaseWalletManager +from torba.client.basemanager import BaseWalletManager from lbryschema.claim import ClaimDict diff --git a/lbrynet/wallet/network.py b/lbrynet/wallet/network.py index 0eadd2ccc..6d9620f6c 100644 --- a/lbrynet/wallet/network.py +++ b/lbrynet/wallet/network.py @@ -1,4 +1,4 @@ -from torba.basenetwork import BaseNetwork +from torba.client.basenetwork import BaseNetwork class Network(BaseNetwork): diff --git a/lbrynet/wallet/script.py b/lbrynet/wallet/script.py index 646b089c4..02f1bfda0 100644 --- a/lbrynet/wallet/script.py +++ b/lbrynet/wallet/script.py @@ -1,5 +1,5 @@ -from torba.basescript import BaseInputScript, BaseOutputScript, Template -from torba.basescript import PUSH_SINGLE, PUSH_INTEGER, OP_DROP, OP_2DROP, PUSH_SUBSCRIPT, OP_VERIFY +from torba.client.basescript import BaseInputScript, BaseOutputScript, Template +from torba.client.basescript import PUSH_SINGLE, PUSH_INTEGER, OP_DROP, OP_2DROP, PUSH_SUBSCRIPT, OP_VERIFY class InputScript(BaseInputScript): diff --git a/lbrynet/wallet/transaction.py b/lbrynet/wallet/transaction.py index 72e27e0ac..006cc87b7 100644 --- a/lbrynet/wallet/transaction.py +++ b/lbrynet/wallet/transaction.py @@ -4,8 +4,8 @@ from typing import List, Iterable, Optional from lbryschema.decode import smart_decode from .account import Account -from torba.basetransaction import BaseTransaction, BaseInput, BaseOutput -from torba.hash import hash160 +from torba.client.basetransaction import BaseTransaction, BaseInput, BaseOutput +from torba.client.hash import hash160 from lbryschema.claim import ClaimDict from .script import InputScript, OutputScript diff --git a/setup.py b/setup.py index d218099f1..b901dfdbe 100644 --- a/setup.py +++ b/setup.py @@ -46,7 +46,7 @@ setup( 'test': ( 'mock>=2.0,<3.0', 'faker==0.8.17', - 'orchstr8>=0.0.4' + 'torba[server]' ) } ) diff --git a/tests/integration/wallet/test_commands.py b/tests/integration/wallet/test_commands.py index 276cf2d34..702c4770b 100644 --- a/tests/integration/wallet/test_commands.py +++ b/tests/integration/wallet/test_commands.py @@ -8,7 +8,7 @@ from twisted.trial import unittest from twisted.internet import utils, defer from twisted.internet.utils import runWithWarningsSuppressed as originalRunWith -from orchstr8.testcase import IntegrationTestCase as BaseIntegrationTestCase +from torba.testcase import IntegrationTestCase as BaseIntegrationTestCase import lbryschema lbryschema.BLOCKCHAIN_NAME = 'lbrycrd_regtest' @@ -26,9 +26,6 @@ from lbrynet.daemon.ComponentManager import ComponentManager from lbrynet.daemon.auth.server import jsonrpc_dumps_pretty -log = logging.getLogger(__name__) - - class FakeUPnP(UPnPComponent): def __init__(self, component_manager): @@ -114,20 +111,19 @@ utils.runWithWarningsSuppressed = run_with_async_support class CommandTestCase(IntegrationTestCase): timeout = 180 - WALLET_MANAGER = LbryWalletManager + MANAGER = LbryWalletManager async def setUp(self): await super().setUp() - if self.VERBOSE: - log.setLevel(logging.DEBUG) - logging.getLogger('lbrynet.core').setLevel(logging.DEBUG) + logging.getLogger('lbrynet.core').setLevel(self.VERBOSITY) + logging.getLogger('lbrynet.daemon').setLevel(self.VERBOSITY) lbry_conf.settings = None lbry_conf.initialize_settings(load_conf_file=False) - lbry_conf.settings['data_dir'] = self.stack.wallet.data_path - lbry_conf.settings['lbryum_wallet_dir'] = self.stack.wallet.data_path - lbry_conf.settings['download_directory'] = self.stack.wallet.data_path + lbry_conf.settings['data_dir'] = self.wallet_node.data_path + lbry_conf.settings['lbryum_wallet_dir'] = self.wallet_node.data_path + lbry_conf.settings['download_directory'] = self.wallet_node.data_path lbry_conf.settings['use_upnp'] = False lbry_conf.settings['reflect_uploads'] = False lbry_conf.settings['blockchain_name'] = 'lbrycrd_regtest' @@ -187,7 +183,8 @@ class CommandTestCase(IntegrationTestCase): class EpicAdventuresOfChris45(CommandTestCase): - VERBOSE = False + + VERBOSITY = logging.WARN async def test_no_this_is_not_a_test_its_an_adventure(self): # Chris45 is an avid user of LBRY and this is his story. It's fact and fiction @@ -466,7 +463,7 @@ class AccountManagement(CommandTestCase): class PublishCommand(CommandTestCase): - VERBOSE = False + VERBOSITY = logging.WARN async def test_publishing_checks_all_accounts_for_certificate(self): account1_id, account1 = self.account.id, self.account diff --git a/tests/integration/wallet/test_transactions.py b/tests/integration/wallet/test_transactions.py index 90e9e2d19..3a583d94b 100644 --- a/tests/integration/wallet/test_transactions.py +++ b/tests/integration/wallet/test_transactions.py @@ -1,6 +1,7 @@ +import logging import asyncio -from orchstr8.testcase import IntegrationTestCase +from torba.testcase import IntegrationTestCase from lbryschema.claim import ClaimDict from lbrynet.wallet.transaction import Transaction from lbrynet.wallet.account import generate_certificate @@ -39,7 +40,7 @@ example_claim_dict = { class BasicTransactionTest(IntegrationTestCase): - VERBOSE = False + VERBOSITY = logging.WARN async def test_creating_updating_and_abandoning_claim_with_channel(self): diff --git a/tests/unit/lbrynet_daemon/test_Daemon.py b/tests/unit/lbrynet_daemon/test_Daemon.py index d69601adc..814442829 100644 --- a/tests/unit/lbrynet_daemon/test_Daemon.py +++ b/tests/unit/lbrynet_daemon/test_Daemon.py @@ -20,7 +20,7 @@ from lbrynet.daemon.Components import RATE_LIMITER_COMPONENT, HEADERS_COMPONENT, from lbrynet.daemon.Daemon import Daemon as LBRYDaemon from lbrynet.file_manager.EncryptedFileDownloader import ManagedEncryptedFileDownloader from lbrynet.wallet.manager import LbryWalletManager -from torba.wallet import Wallet +from torba.client.wallet import Wallet from lbrynet.core.PaymentRateManager import OnlyFreePaymentsManager from tests import util diff --git a/tests/unit/wallet/test_account.py b/tests/unit/wallet/test_account.py index 30bf7a35b..3aaf5d01e 100644 --- a/tests/unit/wallet/test_account.py +++ b/tests/unit/wallet/test_account.py @@ -1,5 +1,5 @@ -from orchstr8.testcase import AsyncioTestCase -from torba.wallet import Wallet +from torba.testcase import AsyncioTestCase +from torba.client.wallet import Wallet from lbrynet.wallet.ledger import MainNetLedger, WalletDatabase from lbrynet.wallet.header import Headers diff --git a/tests/unit/wallet/test_headers.py b/tests/unit/wallet/test_headers.py index 872c5bac8..1f39979ed 100644 --- a/tests/unit/wallet/test_headers.py +++ b/tests/unit/wallet/test_headers.py @@ -1,7 +1,7 @@ from binascii import unhexlify -from orchstr8.testcase import AsyncioTestCase -from torba.util import ArithUint256 +from torba.testcase import AsyncioTestCase +from torba.client.util import ArithUint256 from lbrynet.wallet.ledger import Headers diff --git a/tests/unit/wallet/test_ledger.py b/tests/unit/wallet/test_ledger.py index 5cd097696..28d0f43c3 100644 --- a/tests/unit/wallet/test_ledger.py +++ b/tests/unit/wallet/test_ledger.py @@ -1,5 +1,5 @@ -from orchstr8.testcase import AsyncioTestCase -from torba.wallet import Wallet +from torba.testcase import AsyncioTestCase +from torba.client.wallet import Wallet from lbrynet.wallet.account import Account from lbrynet.wallet.transaction import Transaction, Output, Input diff --git a/tests/unit/wallet/test_transaction.py b/tests/unit/wallet/test_transaction.py index f3359ac22..4f3b1b96a 100644 --- a/tests/unit/wallet/test_transaction.py +++ b/tests/unit/wallet/test_transaction.py @@ -1,9 +1,9 @@ import unittest from binascii import hexlify, unhexlify -from orchstr8.testcase import AsyncioTestCase -from torba.constants import CENT, COIN, NULL_HASH32 -from torba.wallet import Wallet +from torba.testcase import AsyncioTestCase +from torba.client.constants import CENT, COIN, NULL_HASH32 +from torba.client.wallet import Wallet from lbrynet.wallet.ledger import MainNetLedger from lbrynet.wallet.transaction import Transaction, Output, Input diff --git a/tox.ini b/tox.ini index 9f6ad535b..1c4971caa 100644 --- a/tox.ini +++ b/tox.ini @@ -6,9 +6,7 @@ deps = coverage ../torba ../lbryschema - ../electrumx ../lbryumx - ../orchstr8 extras = test changedir = {toxinidir}/tests setenv =