diff --git a/.travis.yml b/.travis.yml index df43175c3..c90796313 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,9 @@ language: python -python: 2.7 +python: 3.5 sudo: required dist: trusty env: + # XXX: There are too many tests failing on py2.7, so disable this for now. #matrix: #- TOX_ENV=py27 #- TOX_ENV=py34 @@ -30,12 +31,13 @@ install: - travis_retry python setup.py install - travis_retry pip install -r dev_requirements.txt script: - # XXX: For now we're only performing minimal CI checks as most tests are - # broken. Tests will be individually added here as they're fixed. + # XXX: For now we're only performing minimal lint checks as there are way + # too many issues. Once they're all addressed we should change this to 'make + # lint'. - make lint-minimal - - make test-passing + - make test #- if [ -d .tox/$TOX_ENV/ ]; then cd .tox/$TOX_ENV && coverage erase; fi; - #- tox -e $TOX_ENV -- --ignore ethereum/tests/test_vm.py --ignore ethereum/tests/test_state.py + #- tox -e $TOX_ENV -- --ignore ethereum/tests/test_vm.py --ignore ethereum/tests/test_state.py --ignore ethereum/todo_tests #- tox -e $TOX_ENV -- ethereum/tests/test_vm.py #- tox -e $TOX_ENV -- ethereum/tests/test_state.py #- coverage report --show-missing diff --git a/Makefile b/Makefile index c1722ea76..21edb2a50 100644 --- a/Makefile +++ b/Makefile @@ -43,13 +43,10 @@ lint-minimal: python -m flake8 --ignore=F401,F841,F811 --select=F --exclude=todo,experimental,ethash.py,ethash_utils.py ethereum test: - py.test --tb=no ethereum/tests/ + py.test ethereum/tests/ -test-passing: - 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 - -test-failing: - 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 +test-todo: + py.test --continue-on-collection-errors ethereum/todo_tests testnovm: py.test --tb=no ethereum/tests/ --ignore=ethereum/tests/test_vm.py diff --git a/ethereum/pow/chain.py b/ethereum/pow/chain.py index 45f856e9c..64ec16913 100644 --- a/ethereum/pow/chain.py +++ b/ethereum/pow/chain.py @@ -372,7 +372,7 @@ def get_tx_position(self, tx): def get_transaction(self, tx): print('Deprecated. Use get_tx_position') blknum, index = self.get_tx_position(tx) - blk = self.get_block_by_number(blknum) + blk = self.get_block_by_number(blknum) return blk.transactions[index], blk, index # Get descendants of a block @@ -397,7 +397,7 @@ def get_blockhashes_from_hash(self, hash, max): header = block.header hashes = [] - for i in xrange(max): + for i in range(max): hash = header.prevhash block = self.get_block(hash) if block is None: diff --git a/ethereum/slogging.py b/ethereum/slogging.py index 1b1c13986..455476d7c 100644 --- a/ethereum/slogging.py +++ b/ethereum/slogging.py @@ -1,5 +1,6 @@ import logging import json +import sys import textwrap from json.encoder import JSONEncoder from logging import StreamHandler, Formatter, FileHandler @@ -256,11 +257,15 @@ def getLogger(self, name): def _stringify_dict_keys(input_): + if sys.version_info.major == 2: + longType = long # NOQA + else: + longType = int if isinstance(input_, dict): res = {} for k, v in input_.items(): v = _stringify_dict_keys(v) - if not isinstance(k, (int, long, bool, None.__class__)): + if not isinstance(k, (int, longType, bool, None.__class__)): k = str(k) res[k] = v elif isinstance(input_, (list, tuple)): diff --git a/ethereum/utils.py b/ethereum/utils.py index beb9b37f5..3df79b757 100644 --- a/ethereum/utils.py +++ b/ethereum/utils.py @@ -29,8 +29,8 @@ SECP256K1P = 2**256 - 4294968273 if sys.version_info.major == 2: - is_numeric = lambda x: isinstance(x, (int, long)) - is_string = lambda x: isinstance(x, (str, unicode)) + is_numeric = lambda x: isinstance(x, (int, long)) # NOQA + is_string = lambda x: isinstance(x, (str, unicode)) # NOQA def to_string(value): return str(value) @@ -42,7 +42,7 @@ def int_to_bytes(value): def to_string_for_regexp(value): return str(value) - unicode = unicode + unicode = unicode # NOQA def bytearray_to_bytestr(value): return bytes(''.join(chr(c) for c in value))