You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/developer/run-testsuite.rst
+39-1Lines changed: 39 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,14 @@
1
+
.. _run-testsuite:
2
+
1
3
Running the Test Suite
2
4
======================
3
5
4
6
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.
5
7
8
+
9
+
Running the full test suite
10
+
----------------------------
11
+
6
12
To run the full test suite, use the following command:
7
13
8
14
.. code-block:: shell-session
@@ -21,6 +27,9 @@ or use the alias (see :ref:`devel-helpers` for more information):
21
27
22
28
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.
23
29
30
+
Running specific tests
31
+
----------------------
32
+
24
33
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:
25
34
26
35
.. 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
32
41
33
42
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.
34
43
44
+
Running failed tests only
45
+
-------------------------
46
+
35
47
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:
36
48
37
49
.. code-block:: shell-session
38
50
:caption: Running only the last failed tests
39
51
:name: running-last-failed-tests
40
52
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.
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