Comments (8)
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.
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.
I propose to store threading.Event
or threading.Condition
instance in httpserver
and set it in request handlers.
from pytest-httpserver.
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.
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.
What's wrong with the method I described in #3 (comment)? Will you accept my patch implementing this?
from pytest-httpserver.
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.
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)
- Considering bringing plugin under pytest-dev HOT 2
- Add all the necessary imports in the code examples in the doc HOT 2
- Thread hang with hypothesis>=6.0.4 on Apple M1 Pro, Mac OS 12.6.2, Python>=3.10 HOT 11
- Can HTTPServer().handlers be modified from user code? HOT 3
- Recommendations for running both http (non-s) and https test within the same session HOT 2
- header auth matching breaks with Werkzeug>=2.3.0 HOT 5
- `werkzeug.urls` deprecation warnings with Werkzeug 2.3.0 HOT 2
- Twine dependency in 1.0.7 HOT 2
- Waiting without pytest and without starting the server HOT 6
- RFE: please start making github releases HOT 4
- Program stuck on server.stop() HOT 3
- Support Werkzeug 3.0 HOT 2
- Remove `<4` Python version constraint
- Not compatible with werkzeug >= 3.0 HOT 1
- Documentation: a small correction and adding a note for request handler HOT 5
- Add __repr__ to RequestHandler
- Add ability to simulate faults HOT 7
- Add verification for calls recieved HOT 9
- Multiple responses per endpoint HOT 4
- Am I missing something here? Everything seems to require `httpserver.url_for` which breaks everything HOT 3
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-httpserver.