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

Modernize test ASGI applications #854

Merged
merged 1 commit into from
Nov 18, 2020
Merged

Modernize test ASGI applications #854

merged 1 commit into from
Nov 18, 2020

Conversation

florimondmanca
Copy link
Member

Small refactoring PR that cleans up a bunch of test code, replacing the older ASGI 2.0 style:

class App:
    def __init__(self, scope):
        ...

    async def __call__(self, receive, send):
        ...

With an up-to-date ASGI 3.0 style:

async def app(scope, receive, send):
    ...

Also reduce code duplication in tests that were just using a sample "empty response" app.

Copy link
Member

@euri10 euri10 left a comment

Choose a reason for hiding this comment

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

Much love 💗 for net deletion, I left a small suggestion but this can go without !

tests/middleware/test_trace_logging.py Show resolved Hide resolved
@euri10
Copy link
Member

euri10 commented Nov 18, 2020 via email

@florimondmanca
Copy link
Member Author

in this PR or another the CustomServer could be refactored as well, it's currently duplicated all over

Yup ;-)

@florimondmanca florimondmanca merged commit 79a72e3 into master Nov 18, 2020
@florimondmanca florimondmanca deleted the fm/test-apps branch November 18, 2020 21:07
This was referenced Nov 19, 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.

2 participants