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

Using event_loop instead loop #7068

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

belov38
Copy link

@belov38 belov38 commented Nov 3, 2022

DeprecationWarning: 'loop' fixture is deprecated and scheduled for removal, please use 'event_loop' instead

What do these changes do?

Replace loop with event_loop in cli()

Are there changes in behavior for the user?

Related issue number

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes
  • If you provide code modification, please add yourself to CONTRIBUTORS.txt
    • The format is <Name> <Surname>.
    • Please keep alphabetical order, the file is sorted by names.
  • Add a new news fragment into the CHANGES folder
    • name it <issue_id>.<type> for example (588.bugfix)
    • if you don't have an issue_id change it to the pr id after creating the pr
    • ensure type is one of the following:
      • .feature: Signifying a new feature.
      • .bugfix: Signifying a bug fix.
      • .doc: Signifying a documentation improvement.
      • .removal: Signifying a deprecation or removal of public API.
      • .misc: A ticket has been closed, but it is not of interest to users.
    • Make sure to use full sentences with correct case and punctuation, for example: "Fix issue with non-ascii contents in doctest text files."

DeprecationWarning: 'loop' fixture is deprecated and scheduled for removal, please use 'event_loop' instead
Comment on lines +114 to 117
def cli(event_loop, aiohttp_client):
app = web.Application()
app.router.add_get('/', previous)
app.router.add_post('/', previous)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
def cli(event_loop, aiohttp_client):
app = web.Application()
app.router.add_get('/', previous)
app.router.add_post('/', previous)
async def cli(aiohttp_client):
app = web.Application()
app.router.add_get('/', previous)
app.router.add_post('/', previous)

app = web.Application()
app.router.add_get('/', previous)
app.router.add_post('/', previous)
return loop.run_until_complete(aiohttp_client(app))
return event_loop.run_until_complete(aiohttp_client(app))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return event_loop.run_until_complete(aiohttp_client(app))
return await aiohttp_client(app)

Think it's probably better not to use the loop fixture at all 99% of the time these days.

Github is being too awkward for me to suggest the change in one comment...

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.

None yet

2 participants