ethereum / pydevp2p

Python Implementation of the Ethereum P2P stack
MIT License
249 stars 335 forks source link

Test failures on PyPy #37

Open ulope opened 8 years ago

ulope commented 8 years ago

Currently some tests fail on PyPy with a rather confusing error message and traceback.

Example:

____________________________________________________ TestFullApp.test_inc_counter_app[6] _____________________________________________________

self = <devp2p.tests.test_full_app.TestFullApp instance at 0x000000010bc9ae40>, num_nodes = 6

    @pytest.mark.timeout(60)
    def test_inc_counter_app(self, num_nodes):
        class TestDriver(object):
            NUM_NODES = num_nodes
            COUNTER_LIMIT = 1024
            NODES_PASSED_SETUP = set()
            NODES_PASSED_INC_COUNTER = set()

        ExampleServiceIncCounter.testdriver = TestDriver()

        app_helper.run(
            ExampleApp,
            ExampleServiceIncCounter,
            num_nodes=num_nodes,
            min_peers=num_nodes-1,
            max_peers=num_nodes-1,
>           random_port=True  # Use a random port to avoid 'Address already in use' errors
        )

devp2p/tests/test_full_app.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
devp2p/app_helper.py:105: in run
    serve_until_stopped(apps)
devp2p/app_helper.py:65: in serve_until_stopped
    app.join()
devp2p/app.py:45: in join
    service.join()
/Users/ulo/.cache/tox/pydevp2p/pypy/site-packages/gevent/greenlet.py:482: in join
    result = self.parent.switch()
/Users/ulo/.cache/tox/pydevp2p/pypy/site-packages/gevent/hub.py:585: in switch
    return greenlet.switch(self)
/Users/ulo/.pythonz/pythons/PyPy-2.6.1/lib_pypy/greenlet.py:53: in switch
    return self.__switch('switch', (args, kwds))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

target = <Hub at 0x10a47a560 select default pending=0 ref=80 resolver=<gevent.resolver_...readPool at 0x10ad18758 0/2/10>> threadpool=<ThreadPool at 0x10ad18758 0/2/10>>
methodname = 'switch', baseargs = (((), {}),), current = <greenlet.greenlet object at 0x000000010a47ac80>

    def __switch(target, methodname, *baseargs):
        current = getcurrent()
        #
        while not (target.__main or _continulet.is_pending(target)):
            # inlined __nonzero__ ^^^ in case it's overridden
            if not target.__started:
                if methodname == 'switch':
                    greenlet_func = _greenlet_start
                else:
                    greenlet_func = _greenlet_throw
                _continulet.__init__(target, greenlet_func, *baseargs)
                methodname = 'switch'
                baseargs = ()
                target.__started = True
                break
            # already done, go to the parent instead
            # (NB. infinite loop possible, but unlikely, unless you mess
            # up the 'parent' explicitly.  Good enough, because a Ctrl-C
            # will show that the program is caught in this loop here.)
            target = target.parent
            # convert a "raise GreenletExit" into "return GreenletExit"
            if methodname == 'throw':
                try:
                    raise baseargs[0], baseargs[1]
                except GreenletExit, e:
                    methodname = 'switch'
                    baseargs = (((e,), {}),)
                except:
                    baseargs = sys.exc_info()[:2] + baseargs[2:]
        #
        try:
            unbound_method = getattr(_continulet, methodname)
>           args, kwds = unbound_method(current, *baseargs, to=target)
E           assert isinstance(256L, int)

/Users/ulo/.pythonz/pythons/PyPy-2.6.1/lib_pypy/greenlet.py:91: AssertionError
utzig commented 8 years ago

I removed the xfails from test_peer because they only seem to fail when test_full_app is run, so I temporarily changed xfail to skipif on the full app tests.