Skip to content

Commit 90e43a4

Browse files
authored
Add new topic about creating pull requests (#71)
1 parent 671989f commit 90e43a4

4 files changed

Lines changed: 78 additions & 3 deletions

File tree

changelog.d/71.doc.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add new topic about creating pull requests
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
.. _create-prs:
2+
3+
Create Pull Requests
4+
====================
5+
6+
This section outlines the steps for creating pull requests (PRs) for this project.
7+
8+
It is assumed that you already cloned or forked this repostitory and have a working development environment set up.
9+
10+
Follow these steps to create a pull request:
11+
12+
#. On the GitHub project, find a bug or feature you want to work on.
13+
#. In your local repository, create a new branch for your changes.
14+
15+
It's recommended to use the issue number and a descriptive name for the branch that reflects the changes you plan to make.
16+
#. Make your changes in the codebase.
17+
18+
* Ensure that you :ref:`run the test suite <run-testsuite>`.
19+
* Watch for the :ref:`coverage report <interprete-coverage>` and try to keep the coverage high.
20+
* Enhance the documentation if it's a user-facing change.
21+
#. Commit your changes with a clear and concise commit message.
22+
23+
* Include the issue number if applicable and add phrases like ``Fixes #123``.
24+
* It's enough to have a high-level description of the changes.
25+
* The message should explain *why* these changes were necessary.
26+
#. Push your changes and create a pull request On GitHub. GitHub creates a pull request number for you.
27+
#. If useful, :ref:`create a news fragment <add-newsfragments>` of your changes.
28+
29+
This is important for the changelog generation. Push the news fragment to the same branch as your changes.
30+
#. On GitHub, request a review.
31+
#. Address any feedback from the review.
32+
33+
* Make additional commits to your branch as needed.
34+
* Ensure that the test suite passes after your changes.
35+
#. Once the review is complete and all tests pass, squash merge your branch into the main branch.

docs/source/developer/index.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ This guide provides all the necessary information for contributing to the projec
1818
prepare-environment
1919
install-vscode
2020
develop-project
21+
create-pullrequests
2122
run-testsuite
2223
update-package
2324
bump-version
@@ -26,7 +27,7 @@ This guide provides all the necessary information for contributing to the projec
2627
build-changelog
2728
create-release
2829
trigger-actions
29-
30+
3031
build-docs
3132
howto
3233

@@ -35,4 +36,4 @@ This guide provides all the necessary information for contributing to the projec
3536
:caption: Appendix
3637

3738
know-tools-config
38-
knowing-github-setup
39+
knowing-github-setup

docs/source/developer/run-testsuite.rst

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
.. _run-testsuite:
2+
13
Running the Test Suite
24
======================
35

46
To run the test suite for this project, you need to have completed the setup of your development environment as described in the :ref:`prepare-devel-env` topic.
57

8+
9+
Running the full test suite
10+
----------------------------
11+
612
To run the full test suite, use the following command:
713

814
.. code-block:: shell-session
@@ -21,6 +27,9 @@ or use the alias (see :ref:`devel-helpers` for more information):
2127
2228
This command will execute all the tests defined in the project. The test suite is designed to ensure that all components of the project are functioning correctly and to catch any regressions.
2329

30+
Running specific tests
31+
----------------------
32+
2433
In case you want to run a specific test or a subset of tests, specify the path to the test file or the test function. For example:
2534

2635
.. code-block:: shell-session
@@ -32,10 +41,39 @@ In case you want to run a specific test or a subset of tests, specify the path t
3241
3342
In the first example, all tests in `test_module.py` will be executed, while in the second example, only the specific test function `test_function_name` will be run.
3443

44+
Running failed tests only
45+
-------------------------
46+
3547
If one of the test fails and you want to repeat the test run after you have fixed the issue, use the ``--lf``/``--last-failed`` option. For example:
3648

3749
.. code-block:: shell-session
3850
:caption: Running only the last failed tests
3951
:name: running-last-failed-tests
4052
41-
upytest --lf
53+
upytest --lf
54+
55+
56+
.. _interprete-coverage:
57+
58+
Interpreting coverage
59+
---------------------
60+
61+
Coverage is a measure of how much of your code is executed during the tests. The coverage report is only generated when all tests pass.
62+
63+
.. code-block:: text
64+
:caption: Coverate report
65+
66+
[...]
67+
src/docbuild/cli/cmd_validate/process.py 142 3 42 2 97.3% 217->219, 299-303
68+
[...]
69+
src/docbuild/utils/doc.py 20 0 0 0 100.0%
70+
src/docbuild/utils/merge.py 74 0 34 0 100.0%
71+
src/docbuild/utils/paths.py 13 0 6 0 100.0%
72+
--------------------------------------------------------------------------
73+
TOTAL 1866 23 478 6 98.6%
74+
75+
If you look through the report, you will see which lines are not covered by tests indicated by a test coverage lower than 100%. The numbers in the report indicate the line numbers where the code is not executed during the tests.
76+
77+
In this example, the coverage report shows that 98.6% of the code is covered by tests. The file :file:`src/docbuild/cli/cmd_validate/process.py` has a coverage of 97.3%, meaning that some lines in this file are not executed during the tests. These lines are indicated by the numbers in the report, such as ``217->219`` and ``299-303``.
78+
79+
Depending on your code, you might want to improve the test coverage by adding more tests for the uncovered lines. This will help ensure that your code is thoroughly tested and behaves as expected.

0 commit comments

Comments
 (0)