diff --git a/.travis.yml b/.travis.yml index 93e361d89..901f82a9c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,7 +39,7 @@ script: - pip install cython - pip install mock pylint unqlite - pylint lbrynet - - PYTHONPATH=. trial tests - - python -m unittest discover tests/integration + - PYTHONPATH=. trial lbrynet.tests + - python -m unittest discover lbrynet/tests/integration - rvm install ruby-2.3.1 - rvm use 2.3.1 && gem install danger --version '~> 4.0' && danger diff --git a/CHANGELOG.md b/CHANGELOG.md index ceff6db7e..711d3dbcf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ at anytime. ### Changed * Announcing by head blob is turned on by default * Updated reflector server dns + * Moved tests into the lbrynet package. ### Added * Added WAL pragma to sqlite3 diff --git a/tests/__init__.py b/lbrynet/tests/__init__.py similarity index 100% rename from tests/__init__.py rename to lbrynet/tests/__init__.py diff --git a/tests/dht/testNode.py b/lbrynet/tests/dht/testNode.py similarity index 100% rename from tests/dht/testNode.py rename to lbrynet/tests/dht/testNode.py diff --git a/tests/dht/testProtocol.py b/lbrynet/tests/dht/testProtocol.py similarity index 100% rename from tests/dht/testProtocol.py rename to lbrynet/tests/dht/testProtocol.py diff --git a/tests/dht/testRoutingTable.py b/lbrynet/tests/dht/testRoutingTable.py similarity index 100% rename from tests/dht/testRoutingTable.py rename to lbrynet/tests/dht/testRoutingTable.py diff --git a/tests/functional/__init__.py b/lbrynet/tests/functional/__init__.py similarity index 100% rename from tests/functional/__init__.py rename to lbrynet/tests/functional/__init__.py diff --git a/tests/functional/test_misc.py b/lbrynet/tests/functional/test_misc.py similarity index 99% rename from tests/functional/test_misc.py rename to lbrynet/tests/functional/test_misc.py index 82e0b31b6..fe723188e 100644 --- a/tests/functional/test_misc.py +++ b/lbrynet/tests/functional/test_misc.py @@ -32,8 +32,8 @@ from lbrynet.core.RateLimiter import DummyRateLimiter, RateLimiter from lbrynet.core.server.BlobRequestHandler import BlobRequestHandlerFactory from lbrynet.core.server.ServerProtocol import ServerProtocolFactory -from tests import mocks -from tests.util import mk_db_and_blob_dir, rm_db_and_blob_dir +from lbrynet.tests import mocks +from lbrynet.tests.util import mk_db_and_blob_dir, rm_db_and_blob_dir FakeNode = mocks.Node FakeWallet = mocks.Wallet diff --git a/tests/functional/test_reflector.py b/lbrynet/tests/functional/test_reflector.py similarity index 99% rename from tests/functional/test_reflector.py rename to lbrynet/tests/functional/test_reflector.py index f0f8a76eb..951f30444 100644 --- a/tests/functional/test_reflector.py +++ b/lbrynet/tests/functional/test_reflector.py @@ -19,8 +19,8 @@ from lbrynet.lbry_file.client import EncryptedFileOptions from lbrynet.file_manager import EncryptedFileCreator from lbrynet.file_manager import EncryptedFileManager -from tests import mocks -from tests.util import mk_db_and_blob_dir, rm_db_and_blob_dir +from lbrynet.tests import mocks +from lbrynet.tests.util import mk_db_and_blob_dir, rm_db_and_blob_dir class TestReflector(unittest.TestCase): def setUp(self): diff --git a/tests/functional/test_streamify.py b/lbrynet/tests/functional/test_streamify.py similarity index 99% rename from tests/functional/test_streamify.py rename to lbrynet/tests/functional/test_streamify.py index 289dbbf90..937bf1f53 100644 --- a/tests/functional/test_streamify.py +++ b/lbrynet/tests/functional/test_streamify.py @@ -19,7 +19,7 @@ from lbrynet.lbry_file.StreamDescriptor import get_sd_info from lbrynet.core.PeerManager import PeerManager from lbrynet.core.RateLimiter import DummyRateLimiter, RateLimiter -from tests import mocks +from lbrynet.tests import mocks FakeNode = mocks.Node diff --git a/tests/integration/test_integration.py b/lbrynet/tests/integration/test_integration.py similarity index 100% rename from tests/integration/test_integration.py rename to lbrynet/tests/integration/test_integration.py diff --git a/tests/mocks.py b/lbrynet/tests/mocks.py similarity index 100% rename from tests/mocks.py rename to lbrynet/tests/mocks.py diff --git a/tests/unit/__init__.py b/lbrynet/tests/unit/__init__.py similarity index 100% rename from tests/unit/__init__.py rename to lbrynet/tests/unit/__init__.py diff --git a/tests/unit/analytics/__init__.py b/lbrynet/tests/unit/analytics/__init__.py similarity index 100% rename from tests/unit/analytics/__init__.py rename to lbrynet/tests/unit/analytics/__init__.py diff --git a/tests/unit/analytics/test_track.py b/lbrynet/tests/unit/analytics/test_track.py similarity index 100% rename from tests/unit/analytics/test_track.py rename to lbrynet/tests/unit/analytics/test_track.py diff --git a/tests/unit/core/__init__.py b/lbrynet/tests/unit/core/__init__.py similarity index 100% rename from tests/unit/core/__init__.py rename to lbrynet/tests/unit/core/__init__.py diff --git a/tests/unit/core/client/__init__.py b/lbrynet/tests/unit/core/client/__init__.py similarity index 100% rename from tests/unit/core/client/__init__.py rename to lbrynet/tests/unit/core/client/__init__.py diff --git a/tests/unit/core/client/test_ConnectionManager.py b/lbrynet/tests/unit/core/client/test_ConnectionManager.py similarity index 100% rename from tests/unit/core/client/test_ConnectionManager.py rename to lbrynet/tests/unit/core/client/test_ConnectionManager.py diff --git a/tests/unit/core/server/__init__.py b/lbrynet/tests/unit/core/server/__init__.py similarity index 100% rename from tests/unit/core/server/__init__.py rename to lbrynet/tests/unit/core/server/__init__.py diff --git a/tests/unit/core/server/test_BlobRequestHandler.py b/lbrynet/tests/unit/core/server/test_BlobRequestHandler.py similarity index 97% rename from tests/unit/core/server/test_BlobRequestHandler.py rename to lbrynet/tests/unit/core/server/test_BlobRequestHandler.py index 32103e374..d37e5fae3 100644 --- a/tests/unit/core/server/test_BlobRequestHandler.py +++ b/lbrynet/tests/unit/core/server/test_BlobRequestHandler.py @@ -8,7 +8,7 @@ from twisted.trial import unittest from lbrynet.core import Peer from lbrynet.core.server import BlobRequestHandler from lbrynet.core.PaymentRateManager import NegotiatedPaymentRateManager, BasePaymentRateManager -from tests.mocks import BlobAvailabilityTracker as DummyBlobAvailabilityTracker, mock_conf_settings +from lbrynet.tests.mocks import BlobAvailabilityTracker as DummyBlobAvailabilityTracker, mock_conf_settings class TestBlobRequestHandlerQueries(unittest.TestCase): diff --git a/tests/unit/core/server/test_DHTHashAnnouncer.py b/lbrynet/tests/unit/core/server/test_DHTHashAnnouncer.py similarity index 97% rename from tests/unit/core/server/test_DHTHashAnnouncer.py rename to lbrynet/tests/unit/core/server/test_DHTHashAnnouncer.py index 02bf2e9b3..b94351d04 100644 --- a/tests/unit/core/server/test_DHTHashAnnouncer.py +++ b/lbrynet/tests/unit/core/server/test_DHTHashAnnouncer.py @@ -4,7 +4,7 @@ from twisted.internet import defer,task from lbrynet.core.server.DHTHashAnnouncer import DHTHashAnnouncer,DHTHashSupplier from lbrynet.core.utils import random_string from lbrynet.core import log_support, utils -from tests.util import random_lbry_hash +from lbrynet.tests.util import random_lbry_hash class MocDHTNode(object): def __init__(self): diff --git a/tests/unit/core/test_BlobManager.py b/lbrynet/tests/unit/core/test_BlobManager.py similarity index 98% rename from tests/unit/core/test_BlobManager.py rename to lbrynet/tests/unit/core/test_BlobManager.py index f6b4a1f04..8e98eabdd 100644 --- a/tests/unit/core/test_BlobManager.py +++ b/lbrynet/tests/unit/core/test_BlobManager.py @@ -5,7 +5,7 @@ import os import random import string -from tests.util import random_lbry_hash +from lbrynet.tests.util import random_lbry_hash from lbrynet.core.BlobManager import DiskBlobManager from lbrynet.core.HashAnnouncer import DummyHashAnnouncer from lbrynet.core.Peer import Peer diff --git a/tests/unit/core/test_HashBlob.py b/lbrynet/tests/unit/core/test_HashBlob.py similarity index 98% rename from tests/unit/core/test_HashBlob.py rename to lbrynet/tests/unit/core/test_HashBlob.py index d1c282478..7b77be0a8 100644 --- a/tests/unit/core/test_HashBlob.py +++ b/lbrynet/tests/unit/core/test_HashBlob.py @@ -2,7 +2,7 @@ from lbrynet.blob import BlobFile from lbrynet.core.Error import DownloadCanceledError, InvalidDataError -from tests.util import mk_db_and_blob_dir, rm_db_and_blob_dir, random_lbry_hash +from lbrynet.tests.util import mk_db_and_blob_dir, rm_db_and_blob_dir, random_lbry_hash from twisted.trial import unittest from twisted.internet import defer import os diff --git a/tests/unit/core/test_Strategy.py b/lbrynet/tests/unit/core/test_Strategy.py similarity index 98% rename from tests/unit/core/test_Strategy.py rename to lbrynet/tests/unit/core/test_Strategy.py index e2aa6a6d6..c0699035c 100644 --- a/tests/unit/core/test_Strategy.py +++ b/lbrynet/tests/unit/core/test_Strategy.py @@ -5,7 +5,7 @@ import mock from lbrynet.core.PaymentRateManager import NegotiatedPaymentRateManager, BasePaymentRateManager from lbrynet.core.Strategy import BasicAvailabilityWeightedStrategy from lbrynet.core.Offer import Offer -from tests.mocks import BlobAvailabilityTracker as DummyBlobAvailabilityTracker, mock_conf_settings +from lbrynet.tests.mocks import BlobAvailabilityTracker as DummyBlobAvailabilityTracker, mock_conf_settings MAX_NEGOTIATION_TURNS = 10 random.seed(12345) diff --git a/tests/unit/core/test_Wallet.py b/lbrynet/tests/unit/core/test_Wallet.py similarity index 100% rename from tests/unit/core/test_Wallet.py rename to lbrynet/tests/unit/core/test_Wallet.py diff --git a/tests/unit/core/test_log_support.py b/lbrynet/tests/unit/core/test_log_support.py similarity index 100% rename from tests/unit/core/test_log_support.py rename to lbrynet/tests/unit/core/test_log_support.py diff --git a/tests/unit/core/test_utils.py b/lbrynet/tests/unit/core/test_utils.py similarity index 100% rename from tests/unit/core/test_utils.py rename to lbrynet/tests/unit/core/test_utils.py diff --git a/tests/unit/cryptstream/__init__.py b/lbrynet/tests/unit/cryptstream/__init__.py similarity index 100% rename from tests/unit/cryptstream/__init__.py rename to lbrynet/tests/unit/cryptstream/__init__.py diff --git a/tests/unit/cryptstream/test_cryptblob.py b/lbrynet/tests/unit/cryptstream/test_cryptblob.py similarity index 97% rename from tests/unit/cryptstream/test_cryptblob.py rename to lbrynet/tests/unit/cryptstream/test_cryptblob.py index 624f1a747..4cc920077 100644 --- a/tests/unit/cryptstream/test_cryptblob.py +++ b/lbrynet/tests/unit/cryptstream/test_cryptblob.py @@ -3,7 +3,7 @@ from twisted.internet import defer from lbrynet.cryptstream import CryptBlob from lbrynet import conf -from tests.mocks import mock_conf_settings +from lbrynet.tests.mocks import mock_conf_settings from Crypto import Random from Crypto.Cipher import AES diff --git a/tests/unit/dht/__init__.py b/lbrynet/tests/unit/dht/__init__.py similarity index 100% rename from tests/unit/dht/__init__.py rename to lbrynet/tests/unit/dht/__init__.py diff --git a/tests/unit/dht/test_contact.py b/lbrynet/tests/unit/dht/test_contact.py similarity index 100% rename from tests/unit/dht/test_contact.py rename to lbrynet/tests/unit/dht/test_contact.py diff --git a/tests/unit/dht/test_datastore.py b/lbrynet/tests/unit/dht/test_datastore.py similarity index 100% rename from tests/unit/dht/test_datastore.py rename to lbrynet/tests/unit/dht/test_datastore.py diff --git a/tests/unit/dht/test_encoding.py b/lbrynet/tests/unit/dht/test_encoding.py similarity index 100% rename from tests/unit/dht/test_encoding.py rename to lbrynet/tests/unit/dht/test_encoding.py diff --git a/tests/unit/dht/test_kbucket.py b/lbrynet/tests/unit/dht/test_kbucket.py similarity index 100% rename from tests/unit/dht/test_kbucket.py rename to lbrynet/tests/unit/dht/test_kbucket.py diff --git a/tests/unit/dht/test_messages.py b/lbrynet/tests/unit/dht/test_messages.py similarity index 100% rename from tests/unit/dht/test_messages.py rename to lbrynet/tests/unit/dht/test_messages.py diff --git a/tests/unit/dht/test_routingtable.py b/lbrynet/tests/unit/dht/test_routingtable.py similarity index 100% rename from tests/unit/dht/test_routingtable.py rename to lbrynet/tests/unit/dht/test_routingtable.py diff --git a/tests/unit/lbryfile/__init__.py b/lbrynet/tests/unit/lbryfile/__init__.py similarity index 100% rename from tests/unit/lbryfile/__init__.py rename to lbrynet/tests/unit/lbryfile/__init__.py diff --git a/tests/unit/lbryfile/client/__init__.py b/lbrynet/tests/unit/lbryfile/client/__init__.py similarity index 100% rename from tests/unit/lbryfile/client/__init__.py rename to lbrynet/tests/unit/lbryfile/client/__init__.py diff --git a/tests/unit/lbryfile/client/test_EncryptedFileDownloader.py b/lbrynet/tests/unit/lbryfile/client/test_EncryptedFileDownloader.py similarity index 100% rename from tests/unit/lbryfile/client/test_EncryptedFileDownloader.py rename to lbrynet/tests/unit/lbryfile/client/test_EncryptedFileDownloader.py diff --git a/tests/unit/lbryfile/test_EncryptedFileMetadataManager.py b/lbrynet/tests/unit/lbryfile/test_EncryptedFileMetadataManager.py similarity index 98% rename from tests/unit/lbryfile/test_EncryptedFileMetadataManager.py rename to lbrynet/tests/unit/lbryfile/test_EncryptedFileMetadataManager.py index 2807a54af..865527899 100644 --- a/tests/unit/lbryfile/test_EncryptedFileMetadataManager.py +++ b/lbrynet/tests/unit/lbryfile/test_EncryptedFileMetadataManager.py @@ -6,7 +6,7 @@ from lbrynet.lbry_file.EncryptedFileMetadataManager import DBEncryptedFileMetada from lbrynet.core import utils from lbrynet.cryptstream.CryptBlob import CryptBlobInfo from lbrynet.core.Error import NoSuchStreamHash -from tests.util import random_lbry_hash +from lbrynet.tests.util import random_lbry_hash class DBEncryptedFileMetadataManagerTest(unittest.TestCase): def setUp(self): diff --git a/tests/unit/lbryfilemanager/__init__.py b/lbrynet/tests/unit/lbryfilemanager/__init__.py similarity index 100% rename from tests/unit/lbryfilemanager/__init__.py rename to lbrynet/tests/unit/lbryfilemanager/__init__.py diff --git a/tests/unit/lbryfilemanager/test_EncryptedFileCreator.py b/lbrynet/tests/unit/lbryfilemanager/test_EncryptedFileCreator.py similarity index 95% rename from tests/unit/lbryfilemanager/test_EncryptedFileCreator.py rename to lbrynet/tests/unit/lbryfilemanager/test_EncryptedFileCreator.py index ba9f4bf58..1539185b5 100644 --- a/tests/unit/lbryfilemanager/test_EncryptedFileCreator.py +++ b/lbrynet/tests/unit/lbryfilemanager/test_EncryptedFileCreator.py @@ -12,8 +12,8 @@ from lbrynet.core import Session from lbrynet.core.server import DHTHashAnnouncer from lbrynet.file_manager import EncryptedFileCreator from lbrynet.file_manager import EncryptedFileManager -from tests import mocks -from tests.util import mk_db_and_blob_dir, rm_db_and_blob_dir +from lbrynet.tests import mocks +from lbrynet.tests.util import mk_db_and_blob_dir, rm_db_and_blob_dir MB = 2**20 diff --git a/tests/unit/lbryfilemanager/test_EncryptedFileManager.py b/lbrynet/tests/unit/lbryfilemanager/test_EncryptedFileManager.py similarity index 96% rename from tests/unit/lbryfilemanager/test_EncryptedFileManager.py rename to lbrynet/tests/unit/lbryfilemanager/test_EncryptedFileManager.py index 293c23d80..c596e1e1e 100644 --- a/tests/unit/lbryfilemanager/test_EncryptedFileManager.py +++ b/lbrynet/tests/unit/lbryfilemanager/test_EncryptedFileManager.py @@ -3,7 +3,7 @@ from twisted.trial import unittest from lbrynet import conf from lbrynet.file_manager.EncryptedFileDownloader import ManagedEncryptedFileDownloader from lbrynet.file_manager.EncryptedFileManager import EncryptedFileManager -from tests.util import random_lbry_hash +from lbrynet.tests.util import random_lbry_hash class TestEncryptedFileManager(unittest.TestCase): diff --git a/tests/unit/lbrynet_daemon/__init__.py b/lbrynet/tests/unit/lbrynet_daemon/__init__.py similarity index 100% rename from tests/unit/lbrynet_daemon/__init__.py rename to lbrynet/tests/unit/lbrynet_daemon/__init__.py diff --git a/tests/unit/lbrynet_daemon/auth/__init__.py b/lbrynet/tests/unit/lbrynet_daemon/auth/__init__.py similarity index 100% rename from tests/unit/lbrynet_daemon/auth/__init__.py rename to lbrynet/tests/unit/lbrynet_daemon/auth/__init__.py diff --git a/tests/unit/lbrynet_daemon/auth/test_server.py b/lbrynet/tests/unit/lbrynet_daemon/auth/test_server.py similarity index 98% rename from tests/unit/lbrynet_daemon/auth/test_server.py rename to lbrynet/tests/unit/lbrynet_daemon/auth/test_server.py index 4e1cb9086..ea1cefb55 100644 --- a/tests/unit/lbrynet_daemon/auth/test_server.py +++ b/lbrynet/tests/unit/lbrynet_daemon/auth/test_server.py @@ -1,7 +1,7 @@ import mock from twisted.trial import unittest -from tests.mocks import mock_conf_settings +from lbrynet.tests.mocks import mock_conf_settings from lbrynet.daemon.auth import server diff --git a/tests/unit/lbrynet_daemon/test_Daemon.py b/lbrynet/tests/unit/lbrynet_daemon/test_Daemon.py similarity index 93% rename from tests/unit/lbrynet_daemon/test_Daemon.py rename to lbrynet/tests/unit/lbrynet_daemon/test_Daemon.py index 9730f54f8..caab0e742 100644 --- a/tests/unit/lbrynet_daemon/test_Daemon.py +++ b/lbrynet/tests/unit/lbrynet_daemon/test_Daemon.py @@ -10,11 +10,11 @@ from lbrynet.core import Session, PaymentRateManager, Wallet from lbrynet.daemon.Daemon import Daemon as LBRYDaemon from lbrynet.daemon import ExchangeRateManager -from tests import util -from tests.mocks import mock_conf_settings, FakeNetwork -from tests.mocks import BlobAvailabilityTracker as DummyBlobAvailabilityTracker -from tests.mocks import ExchangeRateManager as DummyExchangeRateManager -from tests.mocks import BTCLBCFeed, USDBTCFeed +from lbrynet.tests import util +from lbrynet.tests.mocks import mock_conf_settings, FakeNetwork +from lbrynet.tests.mocks import BlobAvailabilityTracker as DummyBlobAvailabilityTracker +from lbrynet.tests.mocks import ExchangeRateManager as DummyExchangeRateManager +from lbrynet.tests.mocks import BTCLBCFeed, USDBTCFeed def get_test_daemon(data_rate=None, generous=True, with_fee=False): if data_rate is None: diff --git a/tests/unit/lbrynet_daemon/test_DaemonCLI.py b/lbrynet/tests/unit/lbrynet_daemon/test_DaemonCLI.py similarity index 100% rename from tests/unit/lbrynet_daemon/test_DaemonCLI.py rename to lbrynet/tests/unit/lbrynet_daemon/test_DaemonCLI.py diff --git a/tests/unit/lbrynet_daemon/test_Downloader.py b/lbrynet/tests/unit/lbrynet_daemon/test_Downloader.py similarity index 96% rename from tests/unit/lbrynet_daemon/test_Downloader.py rename to lbrynet/tests/unit/lbrynet_daemon/test_Downloader.py index df3e4315c..22ea4273a 100644 --- a/tests/unit/lbrynet_daemon/test_Downloader.py +++ b/lbrynet/tests/unit/lbrynet_daemon/test_Downloader.py @@ -16,10 +16,10 @@ from lbrynet.file_manager.EncryptedFileStatusReport import EncryptedFileStatusRe from lbrynet.file_manager.EncryptedFileDownloader import ManagedEncryptedFileDownloader, ManagedEncryptedFileDownloaderFactory from lbrynet.daemon.ExchangeRateManager import ExchangeRateManager -from tests.mocks import BlobAvailabilityTracker as DummyBlobAvailabilityTracker -from tests.mocks import ExchangeRateManager as DummyExchangeRateManager -from tests.mocks import BTCLBCFeed, USDBTCFeed -from tests.mocks import mock_conf_settings +from lbrynet.tests.mocks import BlobAvailabilityTracker as DummyBlobAvailabilityTracker +from lbrynet.tests.mocks import ExchangeRateManager as DummyExchangeRateManager +from lbrynet.tests.mocks import BTCLBCFeed, USDBTCFeed +from lbrynet.tests.mocks import mock_conf_settings class MocDownloader(object): def __init__(self): diff --git a/tests/unit/lbrynet_daemon/test_ExchangeRateManager.py b/lbrynet/tests/unit/lbrynet_daemon/test_ExchangeRateManager.py similarity index 96% rename from tests/unit/lbrynet_daemon/test_ExchangeRateManager.py rename to lbrynet/tests/unit/lbrynet_daemon/test_ExchangeRateManager.py index 3521ca2ec..5d8d0f8c4 100644 --- a/tests/unit/lbrynet_daemon/test_ExchangeRateManager.py +++ b/lbrynet/tests/unit/lbrynet_daemon/test_ExchangeRateManager.py @@ -3,9 +3,9 @@ from lbrynet.daemon import ExchangeRateManager from lbrynet.core.Error import InvalidExchangeRateResponse from twisted.trial import unittest from twisted.internet import defer -from tests import util -from tests.mocks import ExchangeRateManager as DummyExchangeRateManager -from tests.mocks import BTCLBCFeed, USDBTCFeed +from lbrynet.tests import util +from lbrynet.tests.mocks import ExchangeRateManager as DummyExchangeRateManager +from lbrynet.tests.mocks import BTCLBCFeed, USDBTCFeed class FeeFormatTest(unittest.TestCase): diff --git a/tests/unit/test_conf.py b/lbrynet/tests/unit/test_conf.py similarity index 100% rename from tests/unit/test_conf.py rename to lbrynet/tests/unit/test_conf.py diff --git a/tests/util.py b/lbrynet/tests/util.py similarity index 100% rename from tests/util.py rename to lbrynet/tests/util.py diff --git a/setup.py b/setup.py index 39168be05..9ddd3a687 100644 --- a/setup.py +++ b/setup.py @@ -62,7 +62,7 @@ setup( long_description=long_description, keywords="lbry protocol media", license='MIT', - packages=find_packages(base_dir, exclude=['tests']), + packages=find_packages(base_dir), install_requires=requires, entry_points={'console_scripts': console_scripts}, package_data={