-
-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE] Direct web app (ASGI/WSGI) testing from python tests #1335
Comments
Hi @DanLipsitt Thank you for opening the issue :) Here are some details of how things are composed for the ASGI case (WSGI is similar): CLI imports the app, then automatically uses Python tests are intended to use the same It should be the same code that communicates with ASGI/WSGI apps both in Python tests & CLI. So, it does not expect the server to be running in an HTTP sense (e.g. Though I might be missing something, or there could be some bug - what kind of behavior do you observe with Python tests that does not correspond to the "direct" model of execution? |
Thanks for your reply, @Stranger6667! My setup is very similar to the one in the #1305 bug you linked. I am getting the following error:
This error from requests was deeply confusing at first because the library has a typo and means "scheme" (eg If this isn't enough info, I will try to provide a minimized example for you. Thanks again for your help and for this useful library. |
Indeed! I think I also had this error when I was checking one other issue, as far as I remember it was related to
You're very welcome! It would be great if you could provide a code sample, as it will be easier for me to avoid solving the problem only for my particular setup :) |
I've opened awtkns/fastapi-crudrouter#141 to add Schemathesis tests to that project. Those tests trigger the same issue described here, so hopefully you can use it as a reproduction and kill two birds with one stone. |
Awesome! I'll try to take a look at it this week :) |
CI for awtkns/fastapi-crudrouter#141 appears to be waiting on maintainer approval, but you can see the issue if you check out my branch. |
Tests have been approved and run in fastapi-crudrouter. |
Thank you for pinging me @DanLipsitt! I added a comment there with a suggestion that makes those tests properly executed at least on my machine. Please, take a look :) |
I think it would be nice to add UPDATE: Not sure about that :( |
@DanLipsitt I added some validation & docs to #1399 - let me know if there is anything else I can do. |
It seems that python tests using
schemathesis.from_asgi
are run using Requests, and expect a server to be running. I would like to run the tests directly as happens withschemathesis run --app
on the command line. If this is already possible I was not able to figure out how by reading the docs and searching the code.The text was updated successfully, but these errors were encountered: