From d590302523e795592f82f6ca05c51ad5fb107afe Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Thu, 27 Sep 2018 02:18:24 +0200 Subject: [PATCH] pytest: Fix benchmarks after the fixture migration --- tests/benchmark.py | 31 ++----------------------------- tests/requirements.txt | 2 ++ 2 files changed, 4 insertions(+), 29 deletions(-) diff --git a/tests/benchmark.py b/tests/benchmark.py index 18c756794..b56eeca10 100644 --- a/tests/benchmark.py +++ b/tests/benchmark.py @@ -4,10 +4,8 @@ from time import time from tqdm import tqdm -import logging import pytest import random -import utils num_workers = 480 @@ -21,25 +19,6 @@ def executor(): ex.shutdown(wait=False) -@pytest.fixture(scope="module") -def bitcoind(): - bitcoind = utils.BitcoinD(rpcport=28332) - bitcoind.start() - info = bitcoind.rpc.getblockchaininfo() - # Make sure we have segwit and some funds - if info['blocks'] < 432: - logging.debug("SegWit not active, generating some more blocks") - bitcoind.generate_block(432 - info['blocks']) - - yield bitcoind - - try: - bitcoind.rpc.stop() - except Exception: - bitcoind.proc.kill() - bitcoind.proc.wait() - - def test_single_hop(node_factory, executor): l1 = node_factory.get_node() l2 = node_factory.get_node() @@ -73,10 +52,7 @@ def test_single_hop(node_factory, executor): def test_single_payment(node_factory, benchmark): - l1 = node_factory.get_node() - l2 = node_factory.get_node() - l1.rpc.connect(l2.rpc.getinfo()['id'], 'localhost:%d' % l2.port) - l1.openchannel(l2, 4000000) + l1, l2 = node_factory.line_graph(2) def do_pay(l1, l2): invoice = l2.rpc.invoice(1000, 'invoice-{}'.format(random.random()), 'desc')['bolt11'] @@ -95,10 +71,7 @@ def test_invoice(node_factory, benchmark): def test_pay(node_factory, benchmark): - l1 = node_factory.get_node() - l2 = node_factory.get_node() - l1.rpc.connect(l2.rpc.getinfo()['id'], 'localhost:%d' % l2.port) - l1.openchannel(l2, 4000000) + l1, l2 = node_factory.line_graph(2) invoices = [] for _ in range(1, 100): diff --git a/tests/requirements.txt b/tests/requirements.txt index 818937667..7ed22f82e 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -5,3 +5,5 @@ pytest-xdist==1.22.2 flaky==3.4.0 CherryPy==17.3.0 Flask==1.0.2 +pytest-benchmark==3.1.1 +tqdm==4.26.0