Comments (5)
Personally, I find ContextVar
to be a bad idea, and it's not clear when a context is created/removed. The purpose of ContexVar
appears to be more related to have a context for each request or similar, I think using them as an app-wide global will only lead to problems (problems I've recently encountered with another library that uses them like this).
from pytest-aiohttp.
Having said that, it does appear to be documented behaviour: https://docs.aiohttp.org/en/stable/web_advanced.html#contextvars-support
So, I'm wondering if the bug might even be in aiohttp.
from pytest-aiohttp.
I believe that @asvetlov mentioned that there's something that needs to be improved wrt case (long ago, in private chats). But I don't remember what exactly and I ended up not going down the rabbit hole myself back then. I seem to recall some connection to the cleanup contexts but maybe I'm misremembering.
from pytest-aiohttp.
Should be done as a part of pytest-asyncio
plugin. Stay tuned.
from pytest-aiohttp.
@Dreamsorcerer contextvars were initially created to solve decimal localcontext problem when it is used in async code.
Generally speaking, they are as bad as thread-local variables, not better and not worse.
I'm trying to avoid contextvars usage in architecture design, but they are useful for tooling like logging, distributed tracing, etc.
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
- Setup GitHub test workflow HOT 1
- Improve README
- Tests fail to run with pytest-asyncio==0.18 and asyncio_mode=strict HOT 1
- asyncio_mode deprecation warning is emitted for test suites that don't use aiohttp at all HOT 7
- 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.