Skip to content
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

Incorrect Return type on _sanic_endpoint_test #6

Closed
ashleysommer opened this issue Jan 28, 2021 · 2 comments · Fixed by #7
Closed

Incorrect Return type on _sanic_endpoint_test #6

ashleysommer opened this issue Jan 28, 2021 · 2 comments · Fixed by #7

Comments

@ashleysommer
Copy link
Member

_sanic_endpoint_test can return response or (request, response) depending if gather_request is specified.

Tuple and Union are around the wrong way.

typing.Tuple[typing.Union[Request, HTTPResponse]]

Should be

typing.Union[typing.Tuple[Request, HTTPResponse], HTTPResponse]
ashleysommer added a commit to ashleysommer/sanic-testing that referenced this issue Jan 28, 2021
… weird App pickling error seen when using TestManager (specifically on the ASGITestClient)

Add logic to remove the CookieJar from ASGITestClient before pickling, then add it back when unpickled. The cookie jar contains a ThreadLock which cannot be pickled.

Fixes sanic-org#3

Improve gather_request logic in TestClient and ASGITestClient, Fixes sanic-org#4

Change "before_server_end" to "before_server_stop". Fixes sanic-org#5

Fix return type on _sanic_endpoint_test, Fixes sanic-org#6

Fixes sanic-org#6
@ahopkins
Copy link
Member

Maybe we should change it to always a tuple:

Tuple[Optional[Request], HTTPResponse]

@ashleysommer
Copy link
Member Author

ashleysommer commented Jan 28, 2021

As part of #7 changes, I also changed the ASGITestClient request() method to return either response or (request, response) depending on whether gather_request was set, so it would match the way SanicTestClient currently works.

But I agree, I think both should actually return Tuple[Optional[Request], HTTPResponse]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants