Skip to content
This repository was archived by the owner on Aug 8, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyethapp/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ def set_config_param(config, s, strict=True):
raise ValueError('Invalid config parameter')
d = config
for key in keys[:-1]:
key = key.strip()
if strict and key not in d:
raise KeyError('Unknown config option %s' % param)
d = d.setdefault(key, {})
Expand Down
37 changes: 31 additions & 6 deletions pyethapp/tests/test_rpc_tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os
import pytest
from subprocess import Popen
from subprocess import Popen, PIPE
import time
import re

#def test_externally(test_app, tmpdir):

Expand All @@ -26,7 +28,6 @@ def test_setup(request, tmpdir):
rpc_tests_dir = prepare_rpc_tests(tmpdir)

test_data = rpc_tests_dir.join('lib/tests/BlockchainTests/bcRPC_API_Test.json')

test_app = Popen([
'pyethapp',
'-d', str(tmpdir),
Expand All @@ -46,12 +47,36 @@ def fin():

@pytest.mark.skipif(os.getenv('TRAVIS') != None, reason="don't start external test on travis")
def test_eth(test_setup):
# The results of the external rpc-tests are not evaluated as:
# Some of the errors of the external rpc-tests are ignored as:
# 1) the Whisper protocol is not implemented and its tests fail;
# 2) the eth_accounts method should be skipped;
# 3) the eth_getFilterLogs fails due to the invalid test data;

ignored_errors = [
'eth_accounts PYTHON should return an array with accounts:',
'eth_getFilterLogs PYTHON should return a list of logs, when asking without defining an address and using toBlock "latest":',
'eth_getFilterLogs PYTHON should return a list of logs, when asking without defining an address and using toBlock "pending":',
'eth_getFilterLogs PYTHON should return a list of logs, when filtering with defining an address and using toBlock "latest":',
'eth_getFilterLogs PYTHON should return a list of logs, when filtering with defining an address and using toBlock "pending":',
'eth_getFilterLogs PYTHON should return a list of logs, when filtering by topic "0x0000000000000000000000000000000000000000000000000000000000000001":',
'eth_getFilterLogs PYTHON should return a list of anonymous logs, when filtering by topic "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff":',
'eth_getFilterLogs PYTHON should return a list of logs, when filtering by topic "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff":',
# The following error is fixed in the PR rpc-tests#9
'eth_getTransactionByBlockNumberAndIndex PYTHON should return transactions for the pending block when using "pending" and sending transactions before:',
'eth_uninstallFilter PYTHON should return a boolean when uninstalling a block filter:']

(test_app, rpc_tests_dir) = test_setup
tests = Popen(['make', 'test.eth'], cwd=str(rpc_tests_dir)).wait()
assert False, tests.stdout
#FIXME: parse test results and generate report in a pytest compatible format
time.sleep(60)
tests = Popen(['make', 'test.eth'], stdout=PIPE, cwd=str(rpc_tests_dir))
output = tests.communicate()[0]
rpc_errors = re.finditer(r' (\d+)\)(.+)\n', output)
success = True
err_string = ''
for e in rpc_errors:
if e.groups()[1].strip() in ignored_errors:
err_string += '\nSkipping: ' + e.groups()[1]
else:
err_string += '\nERROR: ' + e.groups()[1]
success = False
assert success, err_string
#FIXME: generate a report in a pytest compatible format