Skip to content

Conversation

@florimondmanca
Copy link
Contributor

@florimondmanca florimondmanca changed the title Put test server in thread Serve test server in thread Aug 29, 2019
Copy link
Contributor

@sethmlarson sethmlarson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me :)

@florimondmanca
Copy link
Contributor Author

Thanks @sethmlarson, I'll merge once the build passes. :-)

assert (await stream.read(8192, timeout)).startswith(b"HTTP/1.1 200 OK\r\n")

finally:
await stream.close()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the record, I had to add this .close() call otherwise uvicorn would wait for the connection to terminate indefinitely and not shut down. In general I think it's best to make sure we do use the async with or .close() API on the objects manipulated in tests when possible, as we do in the core package.

@florimondmanca florimondmanca merged commit 994403b into master Aug 29, 2019
@florimondmanca florimondmanca deleted the refactor/test-server branch August 29, 2019 21:17
florimondmanca added a commit that referenced this pull request Aug 29, 2019
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 this pull request may close these issues.

3 participants