14.2 在 Linux 或 MacOS 上运行测试套件
在 Linux 和 macOS 上,运行 make test
命令来编译和运行测试:
$ make test
== CPython 3.9
== macOS-10.14.3-x86_64-i386-64bit little-endian
== cwd: /Users/anthonyshaw/cpython/build/test_python_23399
== CPU count: 4
== encodings: locale=UTF-8, FS=utf-8
0:00:00 load avg: 2.14 [ 1/420] test_opcodes passed
0:00:00 load avg: 2.14 [ 2/420] test_grammar passed
...
或者,使用 python
或 python.exe
编译的二进制路径中的 test
包:
$ ./python -m test
== CPython 3.9
== macOS-10.14.3-x86_64-i386-64bit little-endian
== cwd: /Users/anthonyshaw/cpython/build/test_python_23399
== CPU count: 4
== encodings: locale=UTF-8, FS=utf-8
0:00:00 load avg: 2.14 [ 1/420] test_opcodes passed
0:00:00 load avg: 2.14 [ 2/420] test_grammar passed
...
还有一些其他用于测试的 make
目标:
mark 目标
用途
test
运行一组基本的回归测试;
testall
运行两次完整的测试套件,一次不使用 .pyc 文件,另一次则使用 .pyc 文件;
quicktest
运行一组更快的回归测试,不包括耗时较长的测试;
testuniversal
在 OSX 上的通用构建中为这两种体系结构运行测试套件;
coverage
编译和使用 gcov 运行测试;
coverage-lcov
创建覆盖率 HTML 报告。
Last updated