-
-
Notifications
You must be signed in to change notification settings - Fork 757
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
tests: ignore coverage on helper test functions #980
Conversation
tests/test_config.py
Outdated
@@ -159,7 +159,7 @@ def test_ssl_config_combined(tls_certificate_pem_path): | |||
assert config.is_ssl is True | |||
|
|||
|
|||
def asgi2_app(scope): | |||
def asgi2_app(scope): # pragma: no cover |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should not be skipped imho, we have code in config.py that makes the switch from asgi2 to asgi3 :
Lines 331 to 339 in d81b96e
if self.interface == "auto": | |
if inspect.isclass(self.loaded_app): | |
use_asgi_3 = hasattr(self.loaded_app, "__await__") | |
elif inspect.isfunction(self.loaded_app): | |
use_asgi_3 = asyncio.iscoroutinefunction(self.loaded_app) | |
else: | |
call = getattr(self.loaded_app, "__call__", None) | |
use_asgi_3 = asyncio.iscoroutinefunction(call) | |
self.interface = "asgi3" if use_asgi_3 else "asgi2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. But the body of that function is not executed, because the __call__
on the ASGI2Middleware
is never reached.
uvicorn/uvicorn/middleware/asgi2.py
Lines 5 to 7 in e6028a6
async def __call__(self, scope, receive, send): | |
instance = self.app(scope) | |
await instance(receive, send) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated and I'm now adding "pragma" on the exact lines that are needed. What do you think? @euri10
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm thanks !
Co-authored-by: euri10 <[email protected]>
Co-authored-by: euri10 <[email protected]>
* tests: ignore test lines * Update tests/supervisors/test_reload.py Co-authored-by: euri10 <[email protected]> * Update tests/supervisors/test_multiprocess.py Co-authored-by: euri10 <[email protected]> * precision on pragmas Co-authored-by: euri10 <[email protected]>
I'll open several issues for #102
I don't think a single PR will be a good thing to do, but I can merge them in a single one if you think is the best.