Python Continuous Integration: Travis CI, AppVeyor, VSTS, Buildbots¶
The Night’s Watch is Fixing the CIs in the Darkness for You¶
Buildbot Watch: The watchers of CPython’s Continuous Integration
- Pablo Galindo Salgado
- Victor Stinner
The Night’s Watch is Fixing the CIs in the Darkness for You by Pablo Galindo Salgado.
Python Test Suite¶
Python Test Suite can be found in Lib/test/ directory.
Python uses libregrtest test runner which is based on unittest with additional features:
-R 3:3command to check for reference and memory leaks (don’t detect PyMem_RawMalloc leaks, only detect PyMem_Malloc and PyObject_Malloc leaks)
-uresources to enable extra tests. Examples:
-u cpuenables tests which use more CPU
-u largefileenables tests which use a lot of disk space
-m 4Genables tests which use a lot of memory and specify that we allow Python tests to allocate up to 4 GiB.
-wto re-run failed tests in verbose mode
--matchfileto select tests
See devguide documentation: https://devguide.python.org/runtests/
Azure Pipelines PR¶
How to watch buildbots?¶
Report a failure¶
When a buildbot fails, I look at tests logs and I try to check if an issue has already been reported. For example, search for the test method in title (ex: “test_complex” for test_complex() method). If no result, search using the test filename (ex: “test_os” for Lib/test/test_os.py). If there is no result, repeat with full text searchs (“All Text”). If you cannot find any open bug, create a new one:
- The title should contain the test name, test method and the buildbot name. Example: ” test_posix: TestPosixSpawn fails on PPC64 Fedora 3.x”.
- The description should contain the link to the buildbot failure. Try to identify useful parts of tests log and copy them in the description.
- Fill the Python version field (ex: “3.8” for 3.x buildbots)
- Select at least the “Tests” Component. You may select additional Components depending on the bug.
If a bug was already open, you may add a comment to mention that there is a new failure: add at least a link to buildbot name and a link to the failure.
And that’s all! Simple, isn’t it? At this stage, there is no need to investigate the test failure.
To finish, reply to the failure notification on the mailing list with a very short email: add a link to the existing or the freshly created issue, maybe copy one line of the failure and/or the issue title.
Bug example: issue33630.
Analyze a failure¶
Later, you may want to analyze these failures, but I consider that it’s a different job (different “maintenance task”). If you don’t feel able to analyze the bug, you may try to find someone who knows more than you about the failure.
For better bug reports, you can look at the [Changes] tab of a build failure, and try to identify which recent change introduced the regression. This task requires to follow recent commits, since sometimes the failure is old, it’s just that the test fails randomly depending on network issues, system load, or anything else. Sometimes, previous tests have side effects. Or the buildbot owner made a change on the system. There are many different explanation, it’s hard to write a complete list. It’s really on a case by case basis.
Hopefully, it’s now more common that a buildbot failure is obvious and caused by a very specific recent changes which can be found in the [Changes] tab.
Revert on fail¶
It is no longer used by Python.