GithubHelp home page GithubHelp logo

Comments (7)

seifertm avatar seifertm commented on June 13, 2024

This is probably best addressed in pytest-asyncio.

Related issue:
pytest-dev/pytest-asyncio#293

from pytest-aiohttp.

Dreamsorcerer avatar Dreamsorcerer commented on June 13, 2024

I think this is really a design issue with pytest. All pytest plugins are implicitly loaded, so you are using it, simply by having it installed.

Furthermore, the default behaviour as mentioned in that warning is to enable support for any async tests, it has nothing to do with whether aiohttp is used or not.

from pytest-aiohttp.

mgorny avatar mgorny commented on June 13, 2024

I agree. It's been reported a long time ago but unfortunately there's very little we can do at this point. I mean, I'm pretty sure you can imagine the fallout if plugins suddenly started needing to be enabled explicitly.

Hmm, I wonder if patching pytest-asyncio to default to auto would break stuff…

from pytest-aiohttp.

Dreamsorcerer avatar Dreamsorcerer commented on June 13, 2024

Surely it would, as the previous behaviour was always to require a decorator, so it would change the behaviour for everyone who has not configured the setting.

I believe the option was added to both projects in order to make them compatible, at this point I assume both projects do the same thing with very little differences.

I don't think there's anything to fix here though. The approach used by projects like pytest and flake8 which load plugins implicitly is to recommend using virtualenv etc. in order to only install plugins for each project you are working on, rather than installing them globally. So, I can only recommend the same, even if I dislike the approach myself.

from pytest-aiohttp.

mgorny avatar mgorny commented on June 13, 2024

Unfortunately, using a virtualenv doesn't guarantee that the project will actually work in the production environment. The only way to do that is to run tests in exactly the same environment as the actual package will run.

from pytest-aiohttp.

Dreamsorcerer avatar Dreamsorcerer commented on June 13, 2024

Pretty sure they'd just recommend using a virtualenv in production too. Docker containers are also pretty popular these days too.

I believe the option was added to both projects in order to make them compatible, at this point I assume both projects do the same thing with very little differences.

Actually, just looked again, and it actually migrated to using pytest-asyncio. So, this project just changes the default unconfigured state to auto for backwards compatibility, and adds some fixtures.

from pytest-aiohttp.

Dreamsorcerer avatar Dreamsorcerer commented on June 13, 2024

I think another option would be to uninstall pytest-aiohttp, and use aiohttp.pytest_plugin explicitly. This seems to be what core aiohttp itself does: https://github.com/aio-libs/aiohttp/blob/master/tests/conftest.py#L31

from pytest-aiohttp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.