upgrading to new torba

This commit is contained in:
Lex Berezhny 2018-11-04 01:24:41 -05:00
parent 3ce9f31f4b
commit 699c057f2d
25 changed files with 48 additions and 55 deletions

View file

@ -20,11 +20,9 @@ jobs:
name: "Unit Tests w/ Python 3.7" name: "Unit Tests w/ Python 3.7"
install: install:
- pip install coverage - 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/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/torba.git
- pip install git+https://github.com/lbryio/lbryumx.git#latest_rebased
- pip install -e .[test] - pip install -e .[test]
script: script:
- HOME=/tmp coverage run -p --source=lbrynet -m unittest discover -v tests.unit.wallet - HOME=/tmp coverage run -p --source=lbrynet -m unittest discover -v tests.unit.wallet
@ -49,11 +47,9 @@ jobs:
- name: "Integration Tests" - name: "Integration Tests"
install: install:
- pip install tox-travis coverage - 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/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/torba.git && popd
- pushd .. && git clone https://github.com/lbryio/lbryumx.git && cd lbryumx && git checkout latest_rebased && cd .. && popd
script: tox script: tox
after_success: after_success:
- coverage combine tests/ - coverage combine tests/

View file

@ -60,7 +60,8 @@ class ComponentManager:
try: try:
component = self.get_component(condition.component) component = self.get_component(condition.component)
result = condition.evaluate(component) result = condition.evaluate(component)
except Exception as err: except Exception:
log.exception('failed to evaluate condition:')
result = False result = False
return result, "" if result else condition.message return result, "" if result else condition.message

View file

@ -14,8 +14,8 @@ from twisted.internet import defer, reactor
from twisted.internet.task import LoopingCall from twisted.internet.task import LoopingCall
from twisted.python.failure import Failure from twisted.python.failure import Failure
from torba.constants import COIN from torba.client.constants import COIN
from torba.baseaccount import SingleKey, HierarchicalDeterministic from torba.client.baseaccount import SingleKey, HierarchicalDeterministic
from lbryschema.claim import ClaimDict from lbryschema.claim import ClaimDict
from lbryschema.uri import parse_lbry_uri from lbryschema.uri import parse_lbry_uri

View file

@ -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.core.StreamDescriptor import download_sd_blob
from lbrynet.file_manager.EncryptedFileDownloader import ManagedEncryptedFileDownloaderFactory from lbrynet.file_manager.EncryptedFileDownloader import ManagedEncryptedFileDownloaderFactory
from lbrynet import conf from lbrynet import conf
from torba.constants import COIN from torba.client.constants import COIN
from lbrynet.wallet.dewies import dewies_to_lbc from lbrynet.wallet.dewies import dewies_to_lbc
INITIALIZING_CODE = 'initializing' INITIALIZING_CODE = 'initializing'

View file

@ -12,7 +12,7 @@ from lbryschema.decode import smart_decode
from lbrynet import conf from lbrynet import conf
from lbrynet.cryptstream.CryptBlob import CryptBlobInfo from lbrynet.cryptstream.CryptBlob import CryptBlobInfo
from lbrynet.dht.constants import dataExpireTimeout from lbrynet.dht.constants import dataExpireTimeout
from torba.constants import COIN from torba.client.constants import COIN
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View file

@ -4,6 +4,6 @@ __node_bin__ = ''
__node_url__ = ( __node_url__ = (
'https://github.com/lbryio/lbrycrd/releases/download/v0.12.2.1/lbrycrd-linux.zip' '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 from .ledger import MainNetLedger, RegTestLedger

View file

@ -1,8 +1,8 @@
import json import json
import logging import logging
from torba.baseaccount import BaseAccount from torba.client.baseaccount import BaseAccount
from torba.basetransaction import TXORef from torba.client.basetransaction import TXORef
from lbryschema.claim import ClaimDict from lbryschema.claim import ClaimDict
from lbryschema.signer import SECP256k1, get_signer from lbryschema.signer import SECP256k1, get_signer

View file

@ -1,7 +1,7 @@
import six import six
import struct import struct
import binascii import binascii
from torba.hash import double_sha256 from torba.client.hash import double_sha256
class InvalidProofError(Exception): class InvalidProofError(Exception):

View file

@ -1,4 +1,4 @@
from torba.basedatabase import BaseDatabase from torba.client.basedatabase import BaseDatabase
class WalletDatabase(BaseDatabase): class WalletDatabase(BaseDatabase):

View file

@ -1,6 +1,6 @@
import re import re
import textwrap import textwrap
from torba.constants import COIN from torba.client.constants import COIN
def lbc_to_dewies(lbc): def lbc_to_dewies(lbc):

View file

@ -2,9 +2,9 @@ import struct
from typing import Optional from typing import Optional
from binascii import hexlify, unhexlify from binascii import hexlify, unhexlify
from torba.baseheader import BaseHeaders from torba.client.baseheader import BaseHeaders
from torba.util import ArithUint256 from torba.client.util import ArithUint256
from torba.hash import sha512, double_sha256, ripemd160 from torba.client.hash import sha512, double_sha256, ripemd160
class Headers(BaseHeaders): class Headers(BaseHeaders):

View file

@ -4,7 +4,7 @@ from binascii import unhexlify
from lbryschema.error import URIParseError from lbryschema.error import URIParseError
from lbryschema.uri import parse_lbry_uri from lbryschema.uri import parse_lbry_uri
from torba.baseledger import BaseLedger from torba.client.baseledger import BaseLedger
from .resolve import Resolver from .resolve import Resolver
from .account import Account from .account import Account

View file

@ -10,7 +10,7 @@ from typing import Optional
from twisted.internet import defer from twisted.internet import defer
from lbryschema.schema import SECP256k1 from lbryschema.schema import SECP256k1
from torba.basemanager import BaseWalletManager from torba.client.basemanager import BaseWalletManager
from lbryschema.claim import ClaimDict from lbryschema.claim import ClaimDict

View file

@ -1,4 +1,4 @@
from torba.basenetwork import BaseNetwork from torba.client.basenetwork import BaseNetwork
class Network(BaseNetwork): class Network(BaseNetwork):

View file

@ -1,5 +1,5 @@
from torba.basescript import BaseInputScript, BaseOutputScript, Template from torba.client.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 PUSH_SINGLE, PUSH_INTEGER, OP_DROP, OP_2DROP, PUSH_SUBSCRIPT, OP_VERIFY
class InputScript(BaseInputScript): class InputScript(BaseInputScript):

View file

@ -4,8 +4,8 @@ from typing import List, Iterable, Optional
from lbryschema.decode import smart_decode from lbryschema.decode import smart_decode
from .account import Account from .account import Account
from torba.basetransaction import BaseTransaction, BaseInput, BaseOutput from torba.client.basetransaction import BaseTransaction, BaseInput, BaseOutput
from torba.hash import hash160 from torba.client.hash import hash160
from lbryschema.claim import ClaimDict from lbryschema.claim import ClaimDict
from .script import InputScript, OutputScript from .script import InputScript, OutputScript

View file

@ -46,7 +46,7 @@ setup(
'test': ( 'test': (
'mock>=2.0,<3.0', 'mock>=2.0,<3.0',
'faker==0.8.17', 'faker==0.8.17',
'orchstr8>=0.0.4' 'torba[server]'
) )
} }
) )

View file

@ -8,7 +8,7 @@ from twisted.trial import unittest
from twisted.internet import utils, defer from twisted.internet import utils, defer
from twisted.internet.utils import runWithWarningsSuppressed as originalRunWith from twisted.internet.utils import runWithWarningsSuppressed as originalRunWith
from orchstr8.testcase import IntegrationTestCase as BaseIntegrationTestCase from torba.testcase import IntegrationTestCase as BaseIntegrationTestCase
import lbryschema import lbryschema
lbryschema.BLOCKCHAIN_NAME = 'lbrycrd_regtest' lbryschema.BLOCKCHAIN_NAME = 'lbrycrd_regtest'
@ -26,9 +26,6 @@ from lbrynet.daemon.ComponentManager import ComponentManager
from lbrynet.daemon.auth.server import jsonrpc_dumps_pretty from lbrynet.daemon.auth.server import jsonrpc_dumps_pretty
log = logging.getLogger(__name__)
class FakeUPnP(UPnPComponent): class FakeUPnP(UPnPComponent):
def __init__(self, component_manager): def __init__(self, component_manager):
@ -114,20 +111,19 @@ utils.runWithWarningsSuppressed = run_with_async_support
class CommandTestCase(IntegrationTestCase): class CommandTestCase(IntegrationTestCase):
timeout = 180 timeout = 180
WALLET_MANAGER = LbryWalletManager MANAGER = LbryWalletManager
async def setUp(self): async def setUp(self):
await super().setUp() await super().setUp()
if self.VERBOSE: logging.getLogger('lbrynet.core').setLevel(self.VERBOSITY)
log.setLevel(logging.DEBUG) logging.getLogger('lbrynet.daemon').setLevel(self.VERBOSITY)
logging.getLogger('lbrynet.core').setLevel(logging.DEBUG)
lbry_conf.settings = None lbry_conf.settings = None
lbry_conf.initialize_settings(load_conf_file=False) lbry_conf.initialize_settings(load_conf_file=False)
lbry_conf.settings['data_dir'] = self.stack.wallet.data_path lbry_conf.settings['data_dir'] = self.wallet_node.data_path
lbry_conf.settings['lbryum_wallet_dir'] = self.stack.wallet.data_path lbry_conf.settings['lbryum_wallet_dir'] = self.wallet_node.data_path
lbry_conf.settings['download_directory'] = self.stack.wallet.data_path lbry_conf.settings['download_directory'] = self.wallet_node.data_path
lbry_conf.settings['use_upnp'] = False lbry_conf.settings['use_upnp'] = False
lbry_conf.settings['reflect_uploads'] = False lbry_conf.settings['reflect_uploads'] = False
lbry_conf.settings['blockchain_name'] = 'lbrycrd_regtest' lbry_conf.settings['blockchain_name'] = 'lbrycrd_regtest'
@ -187,7 +183,8 @@ class CommandTestCase(IntegrationTestCase):
class EpicAdventuresOfChris45(CommandTestCase): class EpicAdventuresOfChris45(CommandTestCase):
VERBOSE = False
VERBOSITY = logging.WARN
async def test_no_this_is_not_a_test_its_an_adventure(self): 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 # 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): class PublishCommand(CommandTestCase):
VERBOSE = False VERBOSITY = logging.WARN
async def test_publishing_checks_all_accounts_for_certificate(self): async def test_publishing_checks_all_accounts_for_certificate(self):
account1_id, account1 = self.account.id, self.account account1_id, account1 = self.account.id, self.account

View file

@ -1,6 +1,7 @@
import logging
import asyncio import asyncio
from orchstr8.testcase import IntegrationTestCase from torba.testcase import IntegrationTestCase
from lbryschema.claim import ClaimDict from lbryschema.claim import ClaimDict
from lbrynet.wallet.transaction import Transaction from lbrynet.wallet.transaction import Transaction
from lbrynet.wallet.account import generate_certificate from lbrynet.wallet.account import generate_certificate
@ -39,7 +40,7 @@ example_claim_dict = {
class BasicTransactionTest(IntegrationTestCase): class BasicTransactionTest(IntegrationTestCase):
VERBOSE = False VERBOSITY = logging.WARN
async def test_creating_updating_and_abandoning_claim_with_channel(self): async def test_creating_updating_and_abandoning_claim_with_channel(self):

View file

@ -20,7 +20,7 @@ from lbrynet.daemon.Components import RATE_LIMITER_COMPONENT, HEADERS_COMPONENT,
from lbrynet.daemon.Daemon import Daemon as LBRYDaemon from lbrynet.daemon.Daemon import Daemon as LBRYDaemon
from lbrynet.file_manager.EncryptedFileDownloader import ManagedEncryptedFileDownloader from lbrynet.file_manager.EncryptedFileDownloader import ManagedEncryptedFileDownloader
from lbrynet.wallet.manager import LbryWalletManager from lbrynet.wallet.manager import LbryWalletManager
from torba.wallet import Wallet from torba.client.wallet import Wallet
from lbrynet.core.PaymentRateManager import OnlyFreePaymentsManager from lbrynet.core.PaymentRateManager import OnlyFreePaymentsManager
from tests import util from tests import util

View file

@ -1,5 +1,5 @@
from orchstr8.testcase import AsyncioTestCase from torba.testcase import AsyncioTestCase
from torba.wallet import Wallet from torba.client.wallet import Wallet
from lbrynet.wallet.ledger import MainNetLedger, WalletDatabase from lbrynet.wallet.ledger import MainNetLedger, WalletDatabase
from lbrynet.wallet.header import Headers from lbrynet.wallet.header import Headers

View file

@ -1,7 +1,7 @@
from binascii import unhexlify from binascii import unhexlify
from orchstr8.testcase import AsyncioTestCase from torba.testcase import AsyncioTestCase
from torba.util import ArithUint256 from torba.client.util import ArithUint256
from lbrynet.wallet.ledger import Headers from lbrynet.wallet.ledger import Headers

View file

@ -1,5 +1,5 @@
from orchstr8.testcase import AsyncioTestCase from torba.testcase import AsyncioTestCase
from torba.wallet import Wallet from torba.client.wallet import Wallet
from lbrynet.wallet.account import Account from lbrynet.wallet.account import Account
from lbrynet.wallet.transaction import Transaction, Output, Input from lbrynet.wallet.transaction import Transaction, Output, Input

View file

@ -1,9 +1,9 @@
import unittest import unittest
from binascii import hexlify, unhexlify from binascii import hexlify, unhexlify
from orchstr8.testcase import AsyncioTestCase from torba.testcase import AsyncioTestCase
from torba.constants import CENT, COIN, NULL_HASH32 from torba.client.constants import CENT, COIN, NULL_HASH32
from torba.wallet import Wallet from torba.client.wallet import Wallet
from lbrynet.wallet.ledger import MainNetLedger from lbrynet.wallet.ledger import MainNetLedger
from lbrynet.wallet.transaction import Transaction, Output, Input from lbrynet.wallet.transaction import Transaction, Output, Input

View file

@ -6,9 +6,7 @@ deps =
coverage coverage
../torba ../torba
../lbryschema ../lbryschema
../electrumx
../lbryumx ../lbryumx
../orchstr8
extras = test extras = test
changedir = {toxinidir}/tests changedir = {toxinidir}/tests
setenv = setenv =