Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aiohttp-3.6.2 fails tests: #4177

Closed
mgorny opened this issue Oct 11, 2019 · 3 comments
Closed

aiohttp-3.6.2 fails tests: #4177

mgorny opened this issue Oct 11, 2019 · 3 comments

Comments

@mgorny
Copy link
Contributor

mgorny commented Oct 11, 2019

Long story short

The 3.6.2 release has failing test test_aiohttp_request_coroutine[pyloop] due to 'ClientSession._request' was never awaited.

Expected behaviour

Surprisingly, I'd expect tests to pass.

Actual behaviour

A lot of test failures: aiohttp-failures.txt

For example:

_____________________________________________________ test_server_close_keepalive_connection ______________________________________________________

pyfuncitem = <Function 'test_server_close_keepalive_connection'>

    def pytest_pyfunc_call(pyfuncitem):  # type: ignore
        """
        Run coroutines in an event loop instead of a normal function call.
        """
        fast = pyfuncitem.config.getoption("--aiohttp-fast")
        if asyncio.iscoroutinefunction(pyfuncitem.function):
            existing_loop = pyfuncitem.funcargs.get('proactor_loop')\
                or pyfuncitem.funcargs.get('loop', None)
            with _runtime_warning_context():
                with _passthrough_loop_context(existing_loop, fast=fast) as _loop:
                    testargs = {arg: pyfuncitem.funcargs[arg]
                                for arg in pyfuncitem._fixtureinfo.argnames}
>                   _loop.run_until_complete(pyfuncitem.obj(**testargs))

aiohttp/pytest_plugin.py:170: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python3.5/contextlib.py:66: in __exit__
    next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    @contextlib.contextmanager
    def _runtime_warning_context():  # type: ignore
        """
        Context manager which checks for RuntimeWarnings, specifically to
        avoid "coroutine 'X' was never awaited" warnings being missed.
    
        If RuntimeWarnings occur in the context a RuntimeError is raised.
        """
        with warnings.catch_warnings(record=True) as _warnings:
            yield
            rw = ['{w.filename}:{w.lineno}:{w.message}'.format(w=w)
                  for w in _warnings  # type: ignore
                  if w.category == RuntimeWarning]
            if rw:
                raise RuntimeError('{} Runtime Warning{},\n{}'.format(
                    len(rw),
                    '' if len(rw) == 1 else 's',
>                   '\n'.join(rw)
                ))
E               RuntimeError: 1 Runtime Warning,
E               /tmp/aiohttp-3.6.2/tests/test_client_functional.py:2741:coroutine 'noop2' was never awaited

aiohttp/pytest_plugin.py:130: RuntimeError

Steps to reproduce

wget https://files.pythonhosted.org/packages/00/94/f9fa18e8d7124d7850a5715a0b9c0584f7b9375d331d35e157cee50f27cc/aiohttp-3.6.2.tar.gz
tar -xzf aiohttp-3.6.2.tar.gz
cd aiohttp-3.6.2
python setup.py build build_ext -i
PYTHONPATH=. pytest -vv

Your environment

aiohttp-3.6.2 (source)
Gentoo Linux
Python 3.7.4 & 3.5.7 (tried both)

@asvetlov
Copy link
Member

Looks like the bug is fixed by #4213

@prostomarkeloff
Copy link
Contributor

Similar behaviour #4283

@asvetlov
Copy link
Member

I'm curious why CI passes tests? We definitely run it many times per year with success.
Plus I can run 3.7 branch against Python 3.7 with the green result at the end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants