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 more information to contributing page #7916

Merged
merged 42 commits into from
Jan 28, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
d155e00
Add more information to contributing page.
Dreamsorcerer Nov 27, 2023
1abf034
Create 7916.doc
Dreamsorcerer Nov 27, 2023
616576b
Update docs/contributing.rst
Dreamsorcerer Nov 27, 2023
1b67ffa
Update contributing.rst
Dreamsorcerer Nov 27, 2023
4677136
Update 7916.doc
Dreamsorcerer Nov 27, 2023
37a5a3a
Update spelling_wordlist.txt
Dreamsorcerer Nov 27, 2023
d4f956b
Update docs/contributing.rst
Dreamsorcerer Dec 1, 2023
aa58588
Include changes readme
Dreamsorcerer Dec 12, 2023
a2a6ed9
Update README.rst
Dreamsorcerer Dec 12, 2023
c8d8887
Update contributing.rst
Dreamsorcerer Dec 12, 2023
d625b3d
Update spelling_wordlist.txt
Dreamsorcerer Dec 12, 2023
8c3d928
Update contributing.rst
Dreamsorcerer Dec 12, 2023
14acacf
Update README.rst
Dreamsorcerer Dec 12, 2023
c761044
Update README.rst
Dreamsorcerer Dec 12, 2023
7639249
Update README.rst
Dreamsorcerer Dec 12, 2023
91ac91c
Update README.rst
Dreamsorcerer Dec 12, 2023
cb62097
Update CHANGES/7916.doc
Dreamsorcerer Jan 26, 2024
9089797
Update README.rst
Dreamsorcerer Jan 27, 2024
d96b18b
Update contributing.rst
Dreamsorcerer Jan 27, 2024
96b5c39
Create contributing-cov-comment.svg
Dreamsorcerer Jan 27, 2024
a733f0d
Update contributing.rst
Dreamsorcerer Jan 27, 2024
19efe3a
Delete docs/contributing-cov-comment.png
Dreamsorcerer Jan 27, 2024
1c2624b
Create contributing-cov-header.svg
Dreamsorcerer Jan 27, 2024
a2104ba
Update contributing.rst
Dreamsorcerer Jan 27, 2024
8760165
Delete docs/contributing-cov-header.png
Dreamsorcerer Jan 27, 2024
a2123d0
Update contributing.rst
Dreamsorcerer Jan 27, 2024
fe93ad4
Update contributing.rst
Dreamsorcerer Jan 27, 2024
d82e65e
Update README.rst
Dreamsorcerer Jan 27, 2024
7fe88d2
Update docs/contributing.rst
Dreamsorcerer Jan 28, 2024
2c5ab46
Header
Dreamsorcerer Jan 28, 2024
0aadbf2
Update contributing.rst
Dreamsorcerer Jan 28, 2024
1cbad49
Code coverage
Dreamsorcerer Jan 28, 2024
1bc8110
Update 7916.doc
Dreamsorcerer Jan 28, 2024
f4b72b2
.rst
Dreamsorcerer Jan 28, 2024
11fa848
Tip
Dreamsorcerer Jan 28, 2024
d8472a2
Create contributing-cov-partial.svg
Dreamsorcerer Jan 28, 2024
624905c
Create contributing-cov-miss.svg
Dreamsorcerer Jan 28, 2024
191b4c5
Delete docs/contributing-cov-miss.png
Dreamsorcerer Jan 28, 2024
aeb4018
Delete docs/contributing-cov-partial.png
Dreamsorcerer Jan 28, 2024
8284d87
Update contributing.rst
Dreamsorcerer Jan 28, 2024
1310a6d
Merge branch 'master' into docs-contributing
Dreamsorcerer Jan 28, 2024
c949f75
Update docs/contributing.rst
Dreamsorcerer Jan 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES/7916.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated contributing/Tests coverage section to show how we use ``codecov``. -- by :user:`Dreamsorcerer`
Dreamsorcerer marked this conversation as resolved.
Show resolved Hide resolved
Binary file added docs/contributing-cov-comment.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/contributing-cov-header.png
Dreamsorcerer marked this conversation as resolved.
Show resolved Hide resolved
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/contributing-cov-miss.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/contributing-cov-partial.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
63 changes: 48 additions & 15 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -161,29 +161,61 @@ Any extra texts (print statements and so on) should be removed.
Tests coverage
Dreamsorcerer marked this conversation as resolved.
Show resolved Hide resolved
--------------

We are trying hard to have good test coverage; please don't make it worse.
We use *codecov.io* as an indispensable tool for analysing our coverage
results. Visit https://codecov.io/gh/aio-libs/aiohttp to see coverage
reports for the master branch, history, pull requests etc.

Use:
We'll use an example from a real PR to demonstrate how we use this.
Once the tests run in a PR, you'll see a comment posted by *codecov*.
The most important thing to check here is whether there are any new
missed or partial lines in the report:

.. code-block:: shell
.. image:: contributing-cov-comment.png

$ make cov-dev
Here, the PR has introduced 1 miss and 2 partials. Now we
click the link in the comment header to open the full report:

to run test suite and collect coverage information. Once the command
has finished check your coverage at the file that appears in the last
line of the output:
``open file:///.../aiohttp/htmlcov/index.html``
.. image:: contributing-cov-header.png
:alt: Codecov report

Now, if we look through the diff under 'Files changed' we find one of
our partials:

.. image:: contributing-cov-partial.png
:alt: A while loop with partial coverage.

In this case, the while loop is never skipped in our tests. This is
probably not worth writing a test for (and may be a situation that is
impossible to trigger anyway), so we leave this alone.
Dreamsorcerer marked this conversation as resolved.
Show resolved Hide resolved

Please go to the link and make sure that your code change is covered.
We're still missing a partial and a miss, so we switch to the
'Indirect changes' tab and take a look through the diff there. This
time we find the remaining 2 lines:

.. image:: contributing-cov-miss.png
:alt: An if statement that isn't covered anymore.

The project uses *codecov.io* for storing coverage results. Visit
https://codecov.io/gh/aio-libs/aiohttp for looking on coverage of
master branch, history, pull requests etc.
After reviewing the PR, we find that this code is no longer needed as
the changes mean that this method will never be called under those
conditions. Thanks to this report, we were able to remove some
redundant code from a performance-critical part of our codebase (this
check would have been run, probably multiple times, for every single
incoming request).

Dreamsorcerer marked this conversation as resolved.
Show resolved Hide resolved
Other tools
+++++++++++

The browser extension https://docs.codecov.io/docs/browser-extension
is highly recommended for analyzing the coverage just in *Files
Changed* tab on *GitHub Pull Request* review page.
is also a useful tool for analyzing the coverage directly from *Files
Changed* tab on the *GitHub Pull Request* review page.


You can also produce coverage reports locally with ``make cov-dev``
or just adding ``--cov-report=html`` to ``pytest``.

This will run the test suite and collect coverage information. Once
finished, coverage results can be view by opening:
``open file:///.../aiohttp/htmlcov/index.html``
Dreamsorcerer marked this conversation as resolved.
Show resolved Hide resolved

Documentation
-------------
Expand Down Expand Up @@ -249,7 +281,8 @@ The contents of this file are *reStructuredText* formatted text that
will be used as the content of the news file entry. You do not need to
reference the issue or PR numbers here as *towncrier* will automatically
add a reference to all of the affected issues when rendering the news
file.
file. Please also see ``CHANGES/README.rst`` for the correct format of
Dreamsorcerer marked this conversation as resolved.
Show resolved Hide resolved
a changelog fragment.



Expand Down
2 changes: 2 additions & 0 deletions docs/spelling_wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ aiohttpdemo
aiohttp’s
aiopg
alives
analysing
Dreamsorcerer marked this conversation as resolved.
Show resolved Hide resolved
api
api’s
app
Expand Down Expand Up @@ -66,6 +67,7 @@ CIMultiDict
ClientSession
cls
cmd
codebase
codec
Codings
committer
Expand Down