Git Product home page Git Product logo

Comments (4)

samuelcolvin avatar samuelcolvin commented on August 16, 2024

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.

samuelcolvin avatar samuelcolvin commented on August 16, 2024

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.

szastupov avatar szastupov commented on August 16, 2024

Yeah, works as expected 👍 Thanks a lot 🙏

from aiohttp-devtools.

samuelcolvin avatar samuelcolvin commented on August 16, 2024

new version 0.2 deployed with the fix.

from aiohttp-devtools.

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.