11import asyncio
2+ import logging
23
34import pytest
45import rlp
910
1011from eth_hash .auto import keccak
1112
12- from evm .chains .ropsten import ROPSTEN_NETWORK_ID , ROPSTEN_GENESIS_HEADER , ROPSTEN_VM_CONFIGURATION
13+ from evm .chains .ropsten import (
14+ RopstenChain ,
15+ ROPSTEN_NETWORK_ID ,
16+ ROPSTEN_GENESIS_HEADER ,
17+ ROPSTEN_VM_CONFIGURATION ,
18+ )
1319from evm .db .backends .memory import MemoryDB
1420
1521from p2p import ecies
1925from p2p .peer import LESPeer , PeerPool
2026
2127from integration_test_helpers import (
22- FakeAsyncChainDB , FakeAsyncRopstenChain , FakeAsyncHeaderDB , connect_to_peers_loop )
28+ FakeAsyncChainDB ,
29+ FakeAsyncRopstenChain ,
30+ FakeAsyncHeaderDB ,
31+ connect_to_peers_loop ,
32+ )
2333
2434
2535@pytest .mark .asyncio
26- async def test_lightchain_integration (request , event_loop ):
36+ async def test_lightchain_integration (request , event_loop , caplog ):
2737 """Test LightChainSyncer/LightPeerChain against a running geth instance.
2838
2939 In order to run this you need to pass the following to pytest:
3040
31- pytest --integration --enode=...
41+ pytest --integration --capture=no -- enode=...
3242
3343 If you don't have any geth testnet data ready, it is very quick to generate some with:
3444
@@ -43,14 +53,21 @@ async def test_lightchain_integration(request, event_loop):
4353 if not pytest .config .getoption ("--integration" ):
4454 pytest .skip ("Not asked to run integration tests" )
4555
56+ # will almost certainly want verbose logging in a failure
57+ caplog .set_level (logging .DEBUG )
58+
4659 remote = Node .from_uri (pytest .config .getoption ("--enode" ))
4760 base_db = MemoryDB ()
4861 chaindb = FakeAsyncChainDB (base_db )
4962 chaindb .persist_header (ROPSTEN_GENESIS_HEADER )
5063 headerdb = FakeAsyncHeaderDB (base_db )
5164 peer_pool = PeerPool (
52- LESPeer , FakeAsyncHeaderDB (base_db ), ROPSTEN_NETWORK_ID , ecies .generate_privkey (),
53- ROPSTEN_VM_CONFIGURATION )
65+ LESPeer ,
66+ FakeAsyncHeaderDB (base_db ),
67+ ROPSTEN_NETWORK_ID ,
68+ ecies .generate_privkey (),
69+ ROPSTEN_VM_CONFIGURATION ,
70+ )
5471 chain = FakeAsyncRopstenChain (base_db )
5572 syncer = LightChainSyncer (chain , chaindb , peer_pool )
5673 syncer .min_peers_to_sync = 1
0 commit comments