From 3c98b1973ddb8269d95a7de036cb9bd4dd0dcb90 Mon Sep 17 00:00:00 2001 From: mhchia Date: Thu, 26 Dec 2019 20:43:38 +0800 Subject: [PATCH] Remove useless conftest for pubsub --- tests/pubsub/conftest.py | 58 ---------------------------------------- 1 file changed, 58 deletions(-) delete mode 100644 tests/pubsub/conftest.py diff --git a/tests/pubsub/conftest.py b/tests/pubsub/conftest.py deleted file mode 100644 index 520fdf4..0000000 --- a/tests/pubsub/conftest.py +++ /dev/null @@ -1,58 +0,0 @@ -import pytest - -from libp2p.tools.constants import GOSSIPSUB_PARAMS -from libp2p.tools.factories import FloodsubFactory, GossipsubFactory, PubsubFactory - - -@pytest.fixture -def is_strict_signing(): - return False - - -def _make_pubsubs(hosts, pubsub_routers, cache_size, is_strict_signing): - if len(pubsub_routers) != len(hosts): - raise ValueError( - f"lenght of pubsub_routers={pubsub_routers} should be equaled to the " - f"length of hosts={len(hosts)}" - ) - return tuple( - PubsubFactory( - host=host, - router=router, - cache_size=cache_size, - strict_signing=is_strict_signing, - ) - for host, router in zip(hosts, pubsub_routers) - ) - - -@pytest.fixture -def pubsub_cache_size(): - return None # default - - -@pytest.fixture -def gossipsub_params(): - return GOSSIPSUB_PARAMS - - -@pytest.fixture -def pubsubs_fsub(num_hosts, hosts, pubsub_cache_size, is_strict_signing): - floodsubs = FloodsubFactory.create_batch(num_hosts) - _pubsubs_fsub = _make_pubsubs( - hosts, floodsubs, pubsub_cache_size, is_strict_signing - ) - yield _pubsubs_fsub - # TODO: Clean up - - -@pytest.fixture -def pubsubs_gsub( - num_hosts, hosts, pubsub_cache_size, gossipsub_params, is_strict_signing -): - gossipsubs = GossipsubFactory.create_batch(num_hosts, **gossipsub_params._asdict()) - _pubsubs_gsub = _make_pubsubs( - hosts, gossipsubs, pubsub_cache_size, is_strict_signing - ) - yield _pubsubs_gsub - # TODO: Clean up