Giter VIP home page Giter VIP logo

Comments (8)

csernazs avatar csernazs commented on June 27, 2024

Well, in this case I assume that the 3rd party software is doing the request in a separate thread or a process. Is that right?
So the problem is that we don't know when the processing finished. Would it be possible to wait for that thread (by joining to it) or to call wait() on that process which is making the requests?
Then you could safely check httpserver's status.

from pytest-httpserver.

rominf avatar rominf commented on June 27, 2024

We are writing tests for our main product which is written in C++. The request is made in response to request that I'm sending to this program using requests. So, firstly, communication between Python and C++ application is not simple, secondly, we want to test it without knowing implementation details.

Do you have other proposals?

from pytest-httpserver.

rominf avatar rominf commented on June 27, 2024

I propose to store threading.Event or threading.Condition instance in httpserver and set it in request handlers.

from pytest-httpserver.

rominf avatar rominf commented on June 27, 2024

Also, it to would be great to combine it somehow with httpserver.check_assertions to fail as soon as the wrong request arrives.

from pytest-httpserver.

csernazs avatar csernazs commented on June 27, 2024

In Linux you can wait for an file descriptor, thread or process. If you don't have any of these, only the polling will remain, however if you are creating the thread or the process from python directly, I would still suggest waiting on that object (fd, thread, process).
Polling is the last resort. Of course it would work in httpserver as well (let's say in a wait() method) httpserver which would do very similar to your code, but only the waiting would be there, calling the assertions would be the responsibility of the caller.

from pytest-httpserver.

rominf avatar rominf commented on June 27, 2024

What's wrong with the method I described in #3 (comment)? Will you accept my patch implementing this?

from pytest-httpserver.

csernazs avatar csernazs commented on June 27, 2024

If you have a patch for this, that would help me to understand your solution. I think I haven't understood fully what you need and that would help. I can't make any guarantee that the patch will be accepted but I'm ok with using threading events.

from pytest-httpserver.

csernazs avatar csernazs commented on June 27, 2024

I'll be off the grid for a few days, so don't expect timely response from me. I can get back to you mid next week.

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.