Skip to content

3.7.0: Fixture misses attribute #3747

Closed

Description

@JohanLorenzo

From #3742 (comment):

Hello! Thank you for this great library! The Mozilla release engineering team relies on it for several projects 😃

I just found a similar regression:

AttributeError: 'async_generator' object has no attribute 'put'

This async generator is a regular aiohttp.ClientSession() and is initialized here. This might be an integration issue with the pytest-asyncio plugin.

I rolled pytest back to 3.6.4 and things are back working. You can see both the failure and the workaround in

Example

I put up a minimal example over here: https://github.com/JohanLorenzo/pytest-fixture-bug-3747

Activity

  1. RonnyPfannschmidt commented on Jul 31, 2018

    @RonnyPfannschmidt
    Member

    @JohanLorenzo the perceived issue can be fixed by reordering the marker and the fixture declaration

    due to the introduction of the deprecaationwarning the structure changed a bit and the markers dont pass on

    since pytest core doesn't support markers on fixtures to begin with this is a bit of a grey area,
    basically this issue is with pytest-asyncio

    upon quick skimming i beleive it should have declared an own asyncio_fixture decorator as a starting pointpoint

  2. JohanLorenzo commented on Jul 31, 2018

    @JohanLorenzo
    Author

    Got it. Thanks for the context!

    To make sure I get this right, do you mean I should write:

    @pytest.fixture(scope='function')
    @pytest.mark.asyncio
    async def fake_session():

    ?

  3. RonnyPfannschmidt commented on Jul 31, 2018

    @RonnyPfannschmidt
    Member

    correct - i believe that should work, please report back with the details

  4. JohanLorenzo commented on Jul 31, 2018

    @JohanLorenzo
    Author

    Crap, I get the same error after the marker switch :/

  5. RonnyPfannschmidt commented on Jul 31, 2018

    @RonnyPfannschmidt
    Member

    in that case its a unintended interaction with pytest-asyncio that we aren't aware of, please report against pytest-asyncio as well so we can collaborate on the root cause analysis

  6. JohanLorenzo commented on Jul 31, 2018

    @JohanLorenzo
    Author

    Okay. Looks like pytest-dev/pytest-asyncio#89 was already filed. I commented there.

  7. daniloaf commented on Jul 31, 2018

    @daniloaf

    I'm having the same issue when using asyncio inside a fixture, but I'm not using the @pytest.mark.asyncio

  8. added
    status: needs informationreporter needs to provide more information; can be closed after 2 or more weeks of inactivity
    on Aug 1, 2018
  9. added a commit that references this issue on Aug 1, 2018
    c6b11b9
  10. added a commit that references this issue on Aug 3, 2018
  11. added a commit that references this issue on Aug 3, 2018
  12. added a commit that references this issue on Aug 14, 2018
  13. added a commit that references this issue on Aug 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: needs informationreporter needs to provide more information; can be closed after 2 or more weeks of inactivity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions