Skip to content

Commit d1a2d54

Browse files
committed
Use Ropsten VM in lightchain integration test
1 parent 8f5ef47 commit d1a2d54

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

tests/p2p/test_lightchain_integration.py

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import asyncio
2+
import logging
23

34
import pytest
45
import rlp
@@ -9,7 +10,12 @@
910

1011
from 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+
)
1319
from evm.db.backends.memory import MemoryDB
1420

1521
from p2p import ecies
@@ -19,16 +25,20 @@
1925
from p2p.peer import LESPeer, PeerPool
2026

2127
from 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

Comments
 (0)