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

Add debug argument to web.run_app() #3796

Merged
merged 23 commits into from
Apr 24, 2020
Merged

Conversation

NewUserHa
Copy link
Contributor

@NewUserHa NewUserHa commented May 23, 2019

What do these changes do?

Add debug argument to web.run_app() & new_event_loop()

Are there changes in behavior for the user?

no?

Related issue number

Resolves #3793

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."

aiohttp/web.py Outdated Show resolved Hide resolved
Copy link
Member

@asvetlov asvetlov 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 but a few things should be improved.

  1. Add asyncio.set_event_loop(None) at the end of run_app(), just after loop.close()
  2. Document debug parameter here: https://github.com/aio-libs/aiohttp/blame/master/docs/web_reference.rst#L2698

docs/deployment.rst Outdated Show resolved Hide resolved
docs/deployment.rst Outdated Show resolved Hide resolved
Co-Authored-By: Andrew Svetlov <andrew.svetlov@gmail.com>
docs/deployment.rst Outdated Show resolved Hide resolved
Copy link
Member

@asvetlov asvetlov left a comment

Choose a reason for hiding this comment

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

  1. Call asyncio.set_event_loop(None) at the end of the function
  2. Update client_reference.rst to mention debug parameter in run_app docs

aiohttp/web.py Outdated Show resolved Hide resolved
NewUserHa and others added 3 commits May 25, 2019 19:41
Co-Authored-By: Andrew Svetlov <andrew.svetlov@gmail.com>
docs/web_reference.rst Outdated Show resolved Hide resolved
Co-Authored-By: Andrew Svetlov <andrew.svetlov@gmail.com>
@asvetlov
Copy link
Member

The code looks good.
Please take a look at https://travis-ci.com/aio-libs/aiohttp/jobs/203039958
make flake command fails :(

@NewUserHa
Copy link
Contributor Author

thanks
it passes now

@asvetlov
Copy link
Member

Good!
The next and last step is fixing tests.
make test hangs now :(

@NewUserHa
Copy link
Contributor Author

tests/test_run_app.py::test_run_app_http[pyloop] I'm asked to add asyncio.new_event_loop() :(

@NewUserHa
Copy link
Contributor Author

NewUserHa commented May 25, 2019

but this seems about argument position.
what about putting debug flag at the last, again?

but that's keyword-only argument in the test hanged. how did last build success?

@asvetlov
Copy link
Member

The code from PR is correct, tests should be updated to work with it.
All tests that checks some network and thus relies on patched_loop can be easily switched from testing web.run_app() to internal web._run_app()

@NewUserHa
Copy link
Contributor Author

simply replacing web.run_app() with web._run_app() doesn't work

@asvetlov
Copy link
Member

@NewUserHa if you have no time/energy to finish the PR -- that's sad but ok.
I have no estimation when I'll have a time window to work on the issue.
It is not in my current very long to-do list yet, sorry.
Maybe somebody else can pick it up and make it done.

Mechanical run_app() -> _run_app() in tests is not a solution.
You should iterate over all failed tests to figure out how to fix a failure. There is no generic and easy way to make everybody happy.

@NewUserHa
Copy link
Contributor Author

no.
since I'm not familiar with asyncio test, I'm waiting if you have ideas for this. because you said can be easily switched from testing web.run_app() to internal web._run_app()

need I go to find why by myself?

aiohttp/web.py Outdated Show resolved Hide resolved
@NewUserHa
Copy link
Contributor Author

I can't get the change of new_event_loop pass the test, so get back to the original issue that only change the debug argument first.

@codecov-io

This comment has been minimized.

@codecov-io
Copy link

codecov-io commented Jun 23, 2019

Codecov Report

Merging #3796 into master will increase coverage by 0.59%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3796      +/-   ##
==========================================
+ Coverage   97.95%   98.54%   +0.59%     
==========================================
  Files          43       43              
  Lines        8589    11382    +2793     
  Branches     1375     2250     +875     
==========================================
+ Hits         8413    11216    +2803     
+ Misses         74       72       -2     
+ Partials      102       94       -8
Impacted Files Coverage Δ
aiohttp/web.py 99.28% <100%> (+0.17%) ⬆️
aiohttp/frozenlist.py 97.87% <0%> (-2.13%) ⬇️
aiohttp/client_proto.py 96% <0%> (-0.56%) ⬇️
aiohttp/payload.py 98.13% <0%> (-0.47%) ⬇️
aiohttp/web_exceptions.py 100% <0%> (ø) ⬆️
aiohttp/web_middlewares.py 100% <0%> (ø) ⬆️
aiohttp/resolver.py 100% <0%> (ø) ⬆️
aiohttp/web_server.py 100% <0%> (ø) ⬆️
aiohttp/web_routedef.py 100% <0%> (ø) ⬆️
aiohttp/cookiejar.py 100% <0%> (ø) ⬆️
... and 23 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d73e5eb...e7309a6. Read the comment docs.

@webknjaz webknjaz requested a review from asvetlov June 25, 2019 13:01
@webknjaz webknjaz closed this Jul 29, 2019
@webknjaz webknjaz reopened this Jul 29, 2019
@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Apr 24, 2020
@webknjaz webknjaz changed the title Add debug argument to web.run_app() & new_event_loop() Add debug argument to web.run_app() Apr 24, 2020
@webknjaz webknjaz merged commit 3dac414 into aio-libs:master Apr 24, 2020
asvetlov added a commit that referenced this pull request Oct 16, 2020
PR #3796. Closes #3793.

Co-Authored-By: Andrew Svetlov <andrew.svetlov@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot:chronographer:provided There is a change note present in this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add debug argument to web.run_app()
5 participants