@@ -17,40 +17,117 @@ Running
17
17
18
18
The shortest, simplest way of running the test suite is the following command
19
19
from the root directory of your checkout (after you have
20
- :ref: `built Python <compiling >`)::
20
+ :ref: `built Python <compiling >`):
21
21
22
- ./python -m test
22
+ .. tab :: Unix
23
23
24
- You may need to change this command as follows throughout this section.
25
- On :ref: `most <mac-python.exe >` macOS systems, replace :file: `./python `
26
- with :file: `./python.exe `. On Windows, use :file: `python.bat `. If using
27
- Python 2.7, replace ``test `` with ``test.regrtest ``.
24
+ .. code-block :: shell
25
+
26
+ ./python -m test
27
+
28
+ .. tab :: macOS
29
+
30
+ .. code-block :: shell
31
+
32
+ ./python.exe -m test
33
+
34
+ This works on :ref: `most <mac-python.exe >` macOS systems.
35
+
36
+ .. tab :: Windows
37
+
38
+ .. code-block :: dosbatch
39
+
40
+ .\python.bat -m test
28
41
29
42
This will run the majority of tests, but exclude a small portion of them; these
30
43
excluded tests use special kinds of resources: for example, accessing the
31
44
Internet, or trying to play a sound or to display a graphical interface on
32
45
your desktop. They are disabled by default so that running the test suite
33
46
is not too intrusive. To enable some of these additional tests (and for
34
47
other flags which can help debug various issues such as reference leaks), read
35
- the help text::
48
+ the help text:
49
+
50
+ .. tab :: Unix
51
+
52
+ .. code-block :: shell
53
+
54
+ ./python -m test -h
55
+
56
+ .. tab :: macOS
57
+
58
+ .. code-block :: shell
59
+
60
+ ./python.exe -m test -h
36
61
37
- ./python -m test -h
62
+ .. tab :: Windows
63
+
64
+ .. code-block :: dosbatch
65
+
66
+ .\python.bat -m test -h
38
67
39
68
If you want to run a single test file, simply specify the test file name
40
69
(without the extension) as an argument. You also probably want to enable
41
- verbose mode (using ``-v ``), so that individual failures are detailed::
70
+ verbose mode (using ``-v ``), so that individual failures are detailed:
71
+
72
+ .. tab :: Unix
73
+
74
+ .. code-block :: shell
75
+
76
+ ./python -m test -v test_abc
77
+
78
+ .. tab :: macOS
79
+
80
+ .. code-block :: shell
42
81
43
- ./python -m test -v test_abc
82
+ ./python.exe -m test -v test_abc
83
+
84
+ .. tab :: Windows
85
+
86
+ .. code-block :: dosbatch
87
+
88
+ .\python.bat -m test -v test_abc
44
89
45
90
To run a single test case, use the ``unittest `` module, providing the import
46
- path to the test case::
91
+ path to the test case:
92
+
93
+ .. tab :: Unix
94
+
95
+ .. code-block :: shell
96
+
97
+ ./python -m unittest -v test.test_abc.TestABC_Py
98
+
99
+ .. tab :: macOS
47
100
48
- ./python -m unittest -v test.test_abc.TestABC_Py
101
+ .. code-block :: shell
102
+
103
+ ./python.exe -m unittest -v test.test_abc.TestABC_Py
104
+
105
+ .. tab :: Windows
106
+
107
+ .. code-block :: dosbatch
108
+
109
+ .\python.bat -m unittest -v test.test_abc.TestABC_Py
49
110
50
111
Some test modules also support direct invocation,
51
- which might be useful for IDEs and local debugging::
112
+ which might be useful for IDEs and local debugging:
113
+
114
+ .. tab :: Unix
115
+
116
+ .. code-block :: shell
117
+
118
+ ./python Lib/test/test_typing.py
52
119
53
- ./python Lib/test/test_typing.py
120
+ .. tab :: macOS
121
+
122
+ .. code-block :: shell
123
+
124
+ ./python.exe Lib/test/test_typing.py
125
+
126
+ .. tab :: Windows
127
+
128
+ .. code-block :: dosbatch
129
+
130
+ .\python.bat Lib/test/test_typing.py
54
131
55
132
But, there are several important notes:
56
133
@@ -61,19 +138,51 @@ But, there are several important notes:
61
138
most likely it does not support direct invocation.
62
139
63
140
If you have a multi-core or multi-CPU machine, you can enable parallel testing
64
- using several Python processes so as to speed up things::
141
+ using several Python processes so as to speed up things:
142
+
143
+ .. tab :: Unix
144
+
145
+ .. code-block :: shell
65
146
66
- ./python -m test -j0
147
+ ./python -m test -j0
148
+
149
+ .. tab :: macOS
150
+
151
+ .. code-block :: shell
152
+
153
+ ./python.exe -m test -j0
154
+
155
+ .. tab :: Windows
156
+
157
+ .. code-block :: dosbatch
158
+
159
+ .\python.bat -m test -j0
67
160
68
161
If you are running a version of Python prior to 3.3 you must specify the number
69
162
of processes to run simultaneously (e.g. ``-j2 ``).
70
163
71
164
.. _strenuous_testing :
72
165
73
166
Finally, if you want to run tests under a more strenuous set of settings, you
74
- can run ``test `` as::
167
+ can run ``test `` as:
168
+
169
+ .. tab :: Unix
170
+
171
+ .. code-block :: shell
172
+
173
+ ./python -bb -E -Wd -m test -r -w -uall
174
+
175
+ .. tab :: macOS
176
+
177
+ .. code-block :: shell
178
+
179
+ ./python.exe -bb -E -Wd -m test -r -w -uall
180
+
181
+ .. tab :: Windows
182
+
183
+ .. code-block :: dosbatch
75
184
76
- ./ python -bb -E -Wd -m test -r -w -uall
185
+ .\ python.bat -bb -E -Wd -m test -r -w -uall
77
186
78
187
The various extra flags passed to Python cause it to be much stricter about
79
188
various things (the ``-Wd `` flag should be ``-W error `` at some point, but the
0 commit comments