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

Introduce Hypercorn as a local test server on 3.7+ #205

Merged
merged 9 commits into from
Nov 7, 2020

Conversation

florimondmanca
Copy link
Member

@florimondmanca florimondmanca commented Oct 2, 2020

Re-ignite of #194:

Closes #109

100% of our tests now run locally (and switching to pproxy (via #196) made this possible with much less pain :-)).

Note: Hypercorn only runs on 3.7, so on 3.6 we keep testing against the example.org website, like we do currently. There's a bit of overhead to that, but nothing too blocking I hope, and it's actually nice that we keep some coverage against real-world websites.

Follow-ups include:

  • Use Hypercorn for the UDS tests as well, so we remove can Uvicorn entirely (instead of keeping both Hypercorn and Uvicorn as this PR does for now, for ease of reviewing).

scripts/coverage Outdated Show resolved Hide resolved
Copy link
Member

@cdeler cdeler left a comment

Choose a reason for hiding this comment

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

So I've tested your branch (with mitmproxy)

So on my local machine the average test suite run takes 27.63s , whereas the latest master's test run takes more than 90s.

Apart from some questions and a merge conflict, it's a great PR, thank you.

I'm anxious to have these changes in master.

@florimondmanca florimondmanca force-pushed the fm/hypercorn branch 3 times, most recently from 801bd80 to baaf4de Compare October 10, 2020 12:01
@florimondmanca florimondmanca requested a review from a team October 10, 2020 12:03
@florimondmanca
Copy link
Member Author

florimondmanca commented Oct 10, 2020

I'm happy with the state of this PR, and happy enough with the fact that we're testing against a different location on 3.6 and elsewhere, as Hypercorn only supports 3.7+. So given an approval already, if it was only me, I'd push on and go ahead and merge, but… Pinging @tomchristie for some of his thoughts as I see it was a possible space of concern for him (#109 (comment)). :-)

requirements.txt Outdated Show resolved Hide resolved
@florimondmanca
Copy link
Member Author

Happy to take some final reviews, otherwise I think I'll just move forward with this one. :-)

Copy link
Member

@cdeler cdeler left a comment

Choose a reason for hiding this comment

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

Having reviewed that again, I've found it perfect! It would allow us to emulate a lot of things to increase coverage

return (b"host", self._host.encode("ascii"))


class HypercornServer(Server): # pragma: no cover # Python 3.7+ only
Copy link
Member Author

Choose a reason for hiding this comment

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

For the sake of simplicity I'm nocover-ing all these classes that are only used either on 3.6 (where hypercorn isn't available) or on 3.7+ (where hypercorn is available), but I'm also aware that something like conditional coverage could be used to define rules allowing us to only skip coverage on specific versions. For now, keeping it simple. :-)

@florimondmanca
Copy link
Member Author

florimondmanca commented Nov 7, 2020

Successful in 1m

So delighted how fast our test suite is now ✨

Merging, thanks all!

@florimondmanca florimondmanca merged commit df14828 into master Nov 7, 2020
@florimondmanca florimondmanca deleted the fm/hypercorn branch November 7, 2020 12:25
@florimondmanca florimondmanca changed the title Introduce Hypercorn as a local test server Introduce Hypercorn as a local test server on 3.7+ Nov 7, 2020
This was referenced Nov 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Local test server
3 participants