Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit ce7c29c

Browse files
committed
Fix ImportErrors in a bunch of tests and add them to the list we run on travis
Also create a new Makefile rule (test-failing) which runs the tests that are currently failing.
1 parent 19a1303 commit ce7c29c

File tree

8 files changed

+22
-29
lines changed

8 files changed

+22
-29
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ install:
3030
- travis_retry python setup.py install
3131
- travis_retry pip install -r dev_requirements.txt
3232
script:
33-
- make lint-minimal
34-
- make test-minimal
3533
# XXX: For now we're only performing minimal CI checks as most tests are
3634
# broken. Tests will be individually added here as they're fixed.
35+
- make lint-minimal
36+
- make test-passing
3737
#- if [ -d .tox/$TOX_ENV/ ]; then cd .tox/$TOX_ENV && coverage erase; fi;
3838
#- tox -e $TOX_ENV -- --ignore ethereum/tests/test_vm.py --ignore ethereum/tests/test_state.py
3939
#- tox -e $TOX_ENV -- ethereum/tests/test_vm.py

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,11 @@ lint-minimal:
4545
test:
4646
py.test --tb=no ethereum/tests/
4747

48-
test-minimal:
49-
py.test ethereum/tests/test_abi.py ethereum/tests/test_bloom.py ethereum/tests/test_chain.py ethereum/tests/test_compress.py ethereum/tests/test_db.py ethereum/tests/test_difficulty.py ethereum/tests/test_opcodes.py ethereum/tests/test_trie_next_prev.py ethereum/tests/test_utils.py
48+
test-passing:
49+
py.test ethereum/tests/test_abi.py ethereum/tests/test_bloom.py ethereum/tests/test_chain.py ethereum/tests/test_compress.py ethereum/tests/test_db.py ethereum/tests/test_difficulty.py ethereum/tests/test_opcodes.py ethereum/tests/test_trie_next_prev.py ethereum/tests/test_genesis.py ethereum/tests/test_serialization.py ethereum/tests/test_trie.py
50+
51+
test-failing:
52+
py.test ethereum/tests/test_blockstransactions.py ethereum/tests/test_transactions.py ethereum/tests/test_keys.py ethereum/tests/test_state.py ethereum/tests/test_contracts.py ethereum/tests/test_tester.py
5053

5154
testnovm:
5255
py.test --tb=no ethereum/tests/ --ignore=ethereum/tests/test_vm.py

ethereum/tests/todo/test_genesis.py renamed to ethereum/tests/test_genesis.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import os
22
import pytest
33
import json
4-
import ethereum.testutils as testutils
5-
from ethereum.testutils import fixture_to_bytes
4+
from ethereum.tools import testutils
65
import ethereum.utils as utils
76
from ethereum.utils import encode_hex
87
from ethereum.tests.utils import new_env
@@ -27,7 +26,7 @@ def genesis_fixture():
2726
# FIXME: assert that link is uptodate
2827
for k in ('genesis_rlp_hex', 'genesis_state_root', 'genesis_hash'):
2928
assert k in genesis_fixture
30-
return fixture_to_bytes(genesis_fixture)
29+
return genesis_fixture
3130

3231

3332
@pytest.mark.xfail # code not in sync with genesis fixtures

ethereum/tests/todo/test_serialization.py renamed to ethereum/tests/test_serialization.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import rlp
2-
from ethereum import tester, block
2+
from ethereum.tools import tester
3+
from ethereum import block
34
import pytest
45

56

@@ -24,5 +25,5 @@ def test_returnten():
2425
open(filename, 'w').write(mul2_code)
2526
c = s.contract(returnten_code)
2627
s.send(tester.k0, c, 0)
27-
b2 = rlp.decode(rlp.encode(s.block), blocks.Block, env=s.env)
28+
b2 = rlp.decode(rlp.encode(s.block), block.Block, env=s.env)
2829
assert rlp.encode(b2) == rlp.encode(s.block)

ethereum/tests/todo/test_tester.py renamed to ethereum/tests/test_tester.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
import pytest
66

7-
from ethereum.tester import state, ABIContract
8-
from ethereum._solidity import (
7+
from ethereum.tools.tester import Chain, ABIContract
8+
from ethereum.tools._solidity import (
99
get_solidity,
1010
compile_file,
1111
solidity_get_contract_data,
@@ -18,7 +18,7 @@
1818
@pytest.mark.skipif(not SOLIDITY_AVAILABLE, reason='solc compiler not available')
1919
def test_abicontract_interface():
2020
""" Test for issue #370. """
21-
tester_state = state()
21+
tester_state = Chain()
2222

2323
contract_path = path.join(CONTRACTS_DIR, 'simple_contract.sol')
2424
contract_name = 'Simple'
@@ -28,18 +28,15 @@ def test_abicontract_interface():
2828
contract_path,
2929
contract_name,
3030
)
31-
simple_address = tester_state.evm(simple_data['bin'])
31+
simple_address = tester_state.contract(simple_data['bin'])
3232

3333
# ABIContract class must accept json_abi
3434
abi_json = json.dumps(simple_data['abi']).encode('utf-8')
3535

3636
abi = ABIContract(
37-
_state=tester_state,
37+
_chain=tester_state,
3838
_abi=abi_json,
3939
address=simple_address,
40-
listen=False,
41-
log_listener=None,
42-
default_key=None,
4340
)
4441

4542
assert abi.test() == 1 # pylint: disable=no-member

ethereum/tests/todo/test_transactions.py renamed to ethereum/tests/test_transactions.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22
import ethereum.utils as utils
33
import rlp
44
from rlp.utils import decode_hex, encode_hex, str_to_bytes
5-
from ethereum.utils import encode_hex
6-
import ethereum.testutils as testutils
7-
from ethereum.testutils import fixture_to_bytes
8-
from ethereum.state_transition import config_fork_specific_validation
5+
from ethereum.tools import testutils
6+
from ethereum.messages import config_fork_specific_validation
97
import ethereum.config as config
108
import sys
119
import json
@@ -19,11 +17,8 @@
1917
# hint: use 'py.test' with the '-s' option to dump logs to the console
2018
# configure_logging(':trace')
2119

22-
encode_hex('')
23-
2420

2521
def test_transaction(filename, testname, testdata):
26-
testdata = fixture_to_bytes(testdata)
2722

2823
try:
2924
rlpdata = decode_hex(testdata["rlp"][2:])

ethereum/tests/todo/test_trie.py renamed to ethereum/tests/test_trie.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import os
2-
import ethereum.testutils as testutils
32
import json
43
import ethereum.trie as trie
54
import ethereum.db as db
@@ -8,7 +7,6 @@
87
from rlp.utils import decode_hex
98
from ethereum.utils import encode_hex
109
from ethereum.abi import is_string
11-
from ethereum.testutils import fixture_to_bytes
1210
logger = get_logger()
1311

1412
# customize VM log output to your needs
@@ -32,7 +30,7 @@ def load_tests():
3230
sub_fixture = json.load(open(os.path.join(testdir, f)))
3331
for k, v in sub_fixture.items():
3432
fixture[f + "_" + k] = v
35-
return fixture_to_bytes(fixture)
33+
return fixture
3634

3735

3836
def run_test(name, pairs):

ethereum/tests/todo/test_vm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import json
22
import sys
3-
import ethereum.testutils as testutils
3+
from ethereum.tools import testutils
44
from ethereum.slogging import get_logger, configure_logging
55
logger = get_logger()
66
# customize VM log output to your needs
@@ -11,7 +11,7 @@
1111

1212

1313
def test_vm(filename, testname, testdata):
14-
testutils.check_vm_test(testutils.fixture_to_bytes(testdata))
14+
testutils.check_vm_test(testdata)
1515

1616

1717
def pytest_generate_tests(metafunc):

0 commit comments

Comments
 (0)