Giter VIP home page Giter VIP logo

Comments (2)

csernazs avatar csernazs commented on August 29, 2024

hi @delthas ,

Is this related to #263?
Were you able to test that example? :)

I'm ok with adding a kwarg-only boolean flag threaded to HTTPServer.__init__. This could be then used at make_server, in a similar way to self.ssl_context, provided this is the only modification needed..

If there are other modifications needed, I suggest creating a subclass, extracting make_server to a method, which is then overridden. That subclass would do the thread-specific overrides needed (vs. having multiple if self.threaded: blocks).

My main concern is how it performs if there is a handler running in a thread and let's say the client timeouts and the test continues to run. In such case the handler would be still running (eg. handler has sleep(1500)). Threads cannot be stopped (killed) easily, and in the case of pytest-httpserver we want to provide a clean http server instance (which means: no handlers registered, log cleared, no handlers processing anything from the last test, no cross-talk.
So if there's a way, I would suggest waiting (joining) for all the running handlers' threads before we move on to the next test.

So in summary, I'm open to the idea, but we need to do it very carefully.
We can also document and indicate that this is experimental, "do it at your own risk", if needed.

What do you think?

I'm happy to work on the code as well, but it is also ok if you open a PR. Just make sure docstrings are updated.

Zsolt

from pytest-httpserver.

csernazs avatar csernazs commented on August 29, 2024

@delthas FYI, your MR has just been relased as v 1.0.11 with documentations in the howto section. Thanks again for your contribution and apologies for the delayed release!

Zsolt

from pytest-httpserver.

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.