omgnetwork / plasma-mvp

OmiseGO's research implementation of Minimal Viable Plasma
MIT License
561 stars 158 forks source link

Tests don't work on OSX and python 3.6/3.7 #167

Closed PaulRBerg closed 6 years ago

PaulRBerg commented 6 years ago

Issue Type

[x] bug report
[ ] feature request

Current Behavior

Tests do not run on python 3.7. I also tried to run the source code on 3.4.0 and 3.4.8, but I couldn't even pass by make.

Expected Behavior

Test should run with python 3.7, as in the README it specifies "python 3.2+".

Steps to Reproduce

  1. git clone git@github.com:omisego/plasma-mvp.git
  2. make
  3. make test

Full output of error:

Traceback (most recent call last):
  File "/Users/paulrberg/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pytest-3.7.1-py3.7.egg/_pytest/config/__init__.py", line 372, in _getconftestmodules
    return self._path2confmods[path]
KeyError: local('/Users/paulrberg/Documents/DLT/eth/plasma/plasma-mvp/tests')

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/Users/paulrberg/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pytest-3.7.1-py3.7.egg/_pytest/config/__init__.py", line 403, in _importconftest
    return self._conftestpath2mod[conftestpath]
KeyError: local('/Users/paulrberg/Documents/DLT/eth/plasma/plasma-mvp/tests/conftest.py')

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/Users/paulrberg/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pytest-3.7.1-py3.7.egg/_pytest/config/__init__.py", line 409, in _importconftest
    mod = conftestpath.pyimport()
  File "/Users/paulrberg/.pyenv/versions/3.7.0/lib/python3.7/site-packages/py-1.5.4-py3.7.egg/py/_path/local.py", line 668, in pyimport
    __import__(modname)
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
  File "/Users/paulrberg/.pyenv/versions/3.7.0/lib/python3.7/site-packages/pytest-3.7.1-py3.7.egg/_pytest/assertion/rewrite.py", line 226, in load_module
    py.builtin.exec_(co, mod.__dict__)
  File "/Users/paulrberg/Documents/DLT/eth/plasma/plasma-mvp/tests/conftest.py", line 7, in <module>
    from plasma.root_chain.deployer import Deployer
  File "/Users/paulrberg/Documents/DLT/eth/plasma/plasma-mvp/plasma/root_chain/deployer.py", line 4, in <module>
    from web3.contract import ConciseContract
  File "/Users/paulrberg/.pyenv/versions/3.7.0/lib/python3.7/site-packages/web3-4.3.0-py3.7.egg/web3/__init__.py", line 8, in <module>
    from web3.main import Web3  # noqa: E402
  File "/Users/paulrberg/.pyenv/versions/3.7.0/lib/python3.7/site-packages/web3-4.3.0-py3.7.egg/web3/main.py", line 26, in <module>
    from web3.providers.eth_tester import (
  File "/Users/paulrberg/.pyenv/versions/3.7.0/lib/python3.7/site-packages/web3-4.3.0-py3.7.egg/web3/providers/__init__.py", line 8, in <module>
    from .websocket import WebsocketProvider  # noqa: F401
  File "/Users/paulrberg/.pyenv/versions/3.7.0/lib/python3.7/site-packages/web3-4.3.0-py3.7.egg/web3/providers/websocket.py", line 9, in <module>
    import websockets
  File "/Users/paulrberg/.pyenv/versions/3.7.0/lib/python3.7/site-packages/websockets-4.0.1-py3.7-macosx-10.13-x86_64.egg/websockets/__init__.py", line 3, in <module>
    from .client import *
  File "/Users/paulrberg/.pyenv/versions/3.7.0/lib/python3.7/site-packages/websockets-4.0.1-py3.7-macosx-10.13-x86_64.egg/websockets/client.py", line 20, in <module>
    from .protocol import WebSocketCommonProtocol
  File "/Users/paulrberg/.pyenv/versions/3.7.0/lib/python3.7/site-packages/websockets-4.0.1-py3.7-macosx-10.13-x86_64.egg/websockets/protocol.py", line 18, in <module>
    from .compatibility import asyncio_ensure_future
  File "/Users/paulrberg/.pyenv/versions/3.7.0/lib/python3.7/site-packages/websockets-4.0.1-py3.7-macosx-10.13-x86_64.egg/websockets/compatibility.py", line 15
    asyncio_ensure_future = asyncio.async           # Python < 3.5
                                        ^
SyntaxError: invalid syntax
ERROR: could not load /Users/paulrberg/Documents/DLT/eth/plasma/plasma-mvp/tests/conftest.py

Notice this line:

asyncio_ensure_future = asyncio.async           # Python < 3.5

System Specs

PaulRBerg commented 6 years ago

Switched to 3.6, now I get 11 failed, 28 passed.

nrryuya commented 6 years ago

I got the same error. (Python 3.6)

Traceback (most recent call last):
  File "/Users/ryuya.nakamura/.pyenv/versions/vyper/lib/python3.6/site-packages/pytest-3.7.1-py3.6.egg/_pytest/config/__init__.py", line 372, in _getconftestmodules
    return self._path2confmods[path]
KeyError: local('/Users/ryuya.nakamura/work/blockchain/plasma-mvp-vyper/tests')

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/Users/ryuya.nakamura/.pyenv/versions/vyper/lib/python3.6/site-packages/pytest-3.7.1-py3.6.egg/_pytest/config/__init__.py", line 403, in _importconftest
    return self._conftestpath2mod[conftestpath]
KeyError: local('/Users/ryuya.nakamura/work/blockchain/plasma-mvp-vyper/tests/conftest.py')

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/Users/ryuya.nakamura/.pyenv/versions/vyper/lib/python3.6/site-packages/pytest-3.7.1-py3.6.egg/_pytest/config/__init__.py", line 409, in _importconftest
    mod = conftestpath.pyimport()
  File "/Users/ryuya.nakamura/.pyenv/versions/vyper/lib/python3.6/site-packages/py-1.5.4-py3.6.egg/py/_path/local.py", line 668, in pyimport
    __import__(modname)
  File "/Users/ryuya.nakamura/.pyenv/versions/vyper/lib/python3.6/site-packages/pytest-3.7.1-py3.6.egg/_pytest/assertion/rewrite.py", line 226, in load_module
    py.builtin.exec_(co, mod.__dict__)
  File "/Users/ryuya.nakamura/work/blockchain/plasma-mvp-vyper/tests/conftest.py", line 3, in <module>
    from ethereum.tools import tester, _solidity
  File "/Users/ryuya.nakamura/.pyenv/versions/vyper/lib/python3.6/site-packages/ethereum-2.3.0-py3.6.egg/ethereum/tools/__init__.py", line 1, in <module>
    from ethereum.tools import keys, new_statetest_utils, testutils, tester, _solidity
  File "/Users/ryuya.nakamura/.pyenv/versions/vyper/lib/python3.6/site-packages/ethereum-2.3.0-py3.6.egg/ethereum/tools/new_statetest_utils.py", line 1, in <module>
    from ethereum.state import State
  File "/Users/ryuya.nakamura/.pyenv/versions/vyper/lib/python3.6/site-packages/ethereum-2.3.0-py3.6.egg/ethereum/state.py", line 8, in <module>
    from ethereum import trie
  File "/Users/ryuya.nakamura/.pyenv/versions/vyper/lib/python3.6/site-packages/ethereum-2.3.0-py3.6.egg/ethereum/trie.py", line 6, in <module>
    from ethereum.abi import is_string
  File "/Users/ryuya.nakamura/.pyenv/versions/vyper/lib/python3.6/site-packages/ethereum-2.3.0-py3.6.egg/ethereum/abi.py", line 9, in <module>
    import yaml
ModuleNotFoundError: No module named 'yaml'
ERROR: could not load /Users/ryuya.nakamura/work/blockchain/plasma-mvp-vyper/tests/conftest.py

I found similar issue in pytest

In this omisego's repo, make clean executes find . -name '*.pyc' -exec rm -f {} + and more. I tried them but it didn't work.

smartcontracts commented 6 years ago

Unfortunately the fix for now is to use py3.6 :-/ Need to figure out a better solution. Will make a new issue to support py3.7 and update README to let users know to use 3.6.