python-trio/pytest-trio

@pytest.mark.trio crash with pytest 3.8.1

touilleMan opened this issue ยท 6 comments

pytest 3.8.1 seems to be incompatible with our use of @pytest.mark.trio marking

Exemple:

import pytest

class TestFoo:

    @pytest.mark.trio
    async def test_bar(self):
        pass

With pytest 3.8.1

$ pip freeze | grep pytest
pytest==3.8.1
pytest-cov==2.6.0
pytest-logbook==1.2.0
pytest-trio==0.5.0
$ py.test tests/test_tt.py   -vvv
============================================================================== test session starts ==============================================================================
platform linux -- Python 3.6.1, pytest-3.8.1, py-1.6.0, pluggy-0.7.1 -- /home/emmanuel/projects/parsec-cloud/venv2/bin/python3.6
cachedir: .pytest_cache
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/home/emmanuel/projects/parsec-cloud/.hypothesis/examples')
rootdir: /home/emmanuel/projects/parsec-cloud, inifile: setup.cfg
plugins: trio-0.5.0, logbook-1.2.0, cov-2.6.0, hypothesis-3.71.10
collected 1 item                                                                                                                                                                

tests/test_tt.py::TestFoo::test_bar FAILED                                                                                                                                [100%]

=================================================================================== FAILURES ====================================================================================
_______________________________________________________________________________ TestFoo.test_bar ________________________________________________________________________________

value = <trio._core._run.Nursery object at 0x7f502b404d30>

    async def yield_(value=None):
>       return await _yield_(value)

venv2/lib/python3.6/site-packages/async_generator/_impl.py:106: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

value = <trio._core._run.Nursery object at 0x7f502b404d30>

    @coroutine
    def _yield_(value):
>       return (yield _wrap(value))
E       TypeError: test_bar() missing 1 required positional argument: 'self'

venv2/lib/python3.6/site-packages/async_generator/_impl.py:99: TypeError
=========================================================================== 1 failed in 0.09 seconds ============================================================================

And with good old pytest 3.8 ๐Ÿ˜„

$ pip freeze | grep pytest
pytest==3.8.0
pytest-cov==2.6.0
pytest-logbook==1.2.0
pytest-trio==0.5.0
$ py.test tests/test_tt.py   -vvv
============================================================================== test session starts ==============================================================================
platform linux -- Python 3.6.1, pytest-3.8.0, py-1.6.0, pluggy-0.7.1 -- /home/emmanuel/projects/parsec-cloud/venv2/bin/python3.6
cachedir: .pytest_cache
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/home/emmanuel/projects/parsec-cloud/.hypothesis/examples')
rootdir: /home/emmanuel/projects/parsec-cloud, inifile: setup.cfg
plugins: trio-0.5.0, logbook-1.2.0, cov-2.6.0, hypothesis-3.71.10
collected 1 item                                                                                                                                                                

tests/test_tt.py::TestFoo::test_bar PASSED                                                                                                                                [100%]

=========================================================================== 1 passed in 0.01 seconds ============================================================================

Also affected by this. git bisect points to pytest-dev/pytest@a0ce9a4.

Thank you!

๐Ÿ‘

@touilleMan want to make a release?

@njsmith version 0.5.1 is live ! \o/

๐ŸŽ‰ ๐Ÿฐ