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
Test Gunicorn Worker #1834
Comments
I can take this on. I agree we should keep it simple and focus on unit testing. One way I've approached unit testing without mocks is by starting a Gunicorn server with the I'll think about some other complementary ways to approach testing of the worker. |
Just dropping a note here to say that I'm working on this and making some slow progress. I started off with the Instead, I'm working on some testing capabilities that will:
Hope to have a PR for review soon. |
This comment was marked as spam.
This comment was marked as spam.
I'm working through a few tedious limitations right now. One of them relates to conditional test coverage. As correctly suggested in the description, we need to change our coverage.py config from The limitation is that we can't cover How do we tell coverage.py, "please exclude Coverage.py has an I tried setting pragmas at the top-level of the modules, but coverage-conditional-plugin doesn't support this (wemake-services/coverage-conditional-plugin#2). Am I missing something? Or will I need to do a PR that resolves wemake-services/coverage-conditional-plugin#2 in order to unblock this? I guess the simplest option would be to add a |
PR submitted (wemake-services/coverage-conditional-plugin#221). This feature will enable entire modules to be conditionally omitted from test coverage measurement. |
Coding for this is done, and we now have a nice way to omit the worker code from test coverage measurement on Windows, thanks to coverage-conditional-plugin 0.9.0. PR coming up shortly. |
Thanks 🙏 |
I'll deprecate the workers within Uvicorn. |
The idea here is to create a setup to test the
gunicorn
worker classes that we have.I don't know how is the best way to achieve this, as
gunicorn
test suite didn't give me much insight on how we can test this integration withoutunittest.mock
. Suggestions are welcome.If you are interested on working on this, go ahead. Some clarifications:
unittest.mock
- if inevitable, explain the reason.workers.py
.Notes
When doing this, please change those lines:
uvicorn/setup.cfg
Lines 39 to 43 in eec7d22
To something more like: https://github.com/encode/starlette/blob/048643adc21e75b668567fc6bcdd3650b89044ea/setup.cfg#L41-L42
Important
The text was updated successfully, but these errors were encountered: