Comments (7)
This is probably best addressed in pytest-asyncio.
Related issue:
pytest-dev/pytest-asyncio#293
from pytest-aiohttp.
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.
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.
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.
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.
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.
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)
- how to set the port to which web server listen HOT 5
- pytest-aiohttp freezes when using `asyncio.create_subprocess_exec` in a process that reads from stdin HOT 1
- Support for asynchronous `create_app()` function in the fixture HOT 2
- The example uses deprecated `loop` parameter of web.Application HOT 4
- README should talk about avoiding _explicit_ loading pytest module HOT 1
- Compatibility with Python3.8 + Windows HOT 1
- pytest-aiohttp is incompatible with pytest-asyncio v0.14.0 HOT 1
- can't use context vars in shutdown HOT 5
- Setup GitHub test workflow HOT 1
- Improve README
- Tests fail to run with pytest-asyncio==0.18 and asyncio_mode=strict HOT 1
- chardet can't be replaced by cchardet HOT 1
- Follow PEP 561 to support type checking with mypy HOT 4
- Example code does not execute HOT 1
- PytestDeprecationWarning with pytest 7.2.0 HOT 6
- 1.0.4: pytest is failing HOT 1
- every test run twice: pyloop and uvloop HOT 4
- Conflicts with pytest-asyncio (sample with redis) HOT 8
- Scoping issues with pytest v3.5.0 HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytest-aiohttp.