Comments (4)
Have you written unit tests yet?
aiohttp-devtools assumes a function which takes loop as an argument so you can easily write tests that use that function. All the test fixture stuff for pytest (much the easiest way of writing tests for aiohttp code) creates a new event loop for every test (or at least every async def
test, which accounts for 99% of aiohttp application tests) and explicitly removes the default loop so you're forced to use the loop which is created for the test and pass a reference to that loop around.
That said, it wouldn't be too hard (as far as i can see right now with a stinking hangover) to modify runserver to accept an app instance instead of a method, however I would still recommend using a function with signature def create_app(loop): -> app
to make testing easier.
from aiohttp-devtools.
Should be fixed in #36, @szastupov please review and let me know if you think that's easier.
Looking back on this I think part of the reason app_factory
had to be a method with that signature was to make testing aiohttp-devtools easier which is clearly the tail wagging the dog.
from aiohttp-devtools.
Yeah, works as expected 👍 Thanks a lot 🙏
from aiohttp-devtools.
new version 0.2
deployed with the fix.
from aiohttp-devtools.
Related Issues (20)
- [feature-request] Adding additional parameters HOT 2
- Reload on additional file changes HOT 2
- No graceful shutdown when CTRL-C HOT 3
- Auto reload get triggered by Emacs tmp files HOT 2
- Incorrect behavior if __name__ == '__main__': sys.exit(main()) HOT 2
- Remove/enable --boxed
- As of 3.10, the *loop* parameter was removed from Event HOT 2
- Not working with python 3.10 version HOT 2
- v1.0 broken (missing JS)
- How do I use aiohttp-devtools with the PyCharm debugger? HOT 2
- runserver doesn't respect host setting HOT 3
- async_generator object has no attribute lock HOT 3
- logging / log format HOT 5
- Looking to wrong server to find static files. HOT 2
- Cleanup context is not always run HOT 7
- Cleanup context is not run on reload on Windows HOT 17
- Host setting not respected HOT 2
- Tests leave python processes and an open port behind
- Let's put `aiohttp-devtools` under the `aio-libs` org on PyPI HOT 5
- Import module order issue HOT 5
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 aiohttp-devtools.