Title: Unify ways to run the Python test suite · Issue #109566 · python/cpython · GitHub
Open Graph Title: Unify ways to run the Python test suite · Issue #109566 · python/cpython
X Title: Unify ways to run the Python test suite · Issue #109566 · python/cpython
Description: There are at least 15 known ways to run the Python test suite. IMO it's too much, it's hard to keep all these code paths consistent. IMO python -m test should be enough to fit all use cases. Maybe we need a --ci, --buildbot, or --strict ...
Open Graph Description: There are at least 15 known ways to run the Python test suite. IMO it's too much, it's hard to keep all these code paths consistent. IMO python -m test should be enough to fit all use cases. Maybe ...
X Description: There are at least 15 known ways to run the Python test suite. IMO it's too much, it's hard to keep all these code paths consistent. IMO python -m test should be enough to fit all use cases...
Opengraph URL: https://github.com/python/cpython/issues/109566
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Unify ways to run the Python test suite","articleBody":"There are at least 15 known ways to run the Python test suite. IMO it's too much, it's hard to keep all these code paths consistent. IMO ``python -m test`` should be enough to fit all use cases.\r\n\r\nMaybe we need a ``--ci``, ``--buildbot``, or ``--strict`` option which would run tests is \"strict\" mode.\r\n\r\n---\r\n\r\nPortable way to run tests:\r\n\r\n```\r\n./python -m test\r\n./python -m test.regrtest\r\n./python -m test.libregrtest\r\n./python -m test.autotest\r\n\r\n./python Lib/test/regrtest.py\r\n./python Lib/test/autotest.py\r\n\r\n./python -c 'from test import autotest'\r\n```\r\n\r\nThe main drawback is that running ``./python`` doesn't work when Python is built with ``./configure --enable-shared``, and it doesn't work when Python is cross-compiled (WASM/WASI buildbots). Moreover, on macOS, ``./python.exe`` must be run instead. On Windows, it's just ``python``.\r\n\r\nUnix, from Python source code:\r\n\r\n```\r\nmake buildbottest TESTOPTS=\"...\"\r\nmake test\r\nmake testall\r\nmake testuniversal\r\nmake hostrunnertest\r\n\r\n./python Tools/scripts/run_tests.py\r\n```\r\n\r\nWindows, from Python source code:\r\n\r\n```\r\nPCbuild\\rt.bat\r\nTools\\buildbot\\test.bat\r\n```\r\n\r\n---\r\n\r\n* Lib/test/autotest.py just runs ``test.libregrtest.main()``.\r\n* Lib/test/regrtest.py runs ``test.libregrtest.main()`` **and** remove ``Lib/test/`` from ``sys.path`` **and** make ``__file__`` an absolute path.\r\n* ``PCbuild\\rt.bat``:\r\n\r\n * python: pass ``-u -Wd -E -bb`` options\r\n * regrtest: pass options passed to ``rt.bat`` (except of options specific to rt.bat)\r\n * most options are to get the path to the python.exe program in PCbuild/\r\n\r\n* ``Tools\\buildbot\\test.bat`` runs ``PCbuild\\rt.bat``:\r\n\r\n * ``rt.bat``: pass ``-q -d`` options.\r\n * regrtest: pass ``-j1 -uall -rwW --slowest --timeout=1200 --fail-env-changed`` options.\r\n * ARM32 SSH pass ``-unetwork -udecimal -usubprocess -uurlfetch -utzdata -rwW --slowest --timeout=1200 --fail-env-changed`` options.\r\n\r\n* ``make buildbottest`` runs ``Tools/scripts/run_tests.py``:\r\n\r\n * python: pass ``$(TESTPYTHONOPTS)`` options.\r\n * regrtest: pass ``-j 1 -u all -W --slowest --fail-env-changed --timeout=$(TESTTIMEOUT) $(TESTOPTS)`` options.\r\n\r\n* ``Tools/scripts/run_tests.py``:\r\n\r\n * python: pass ``-u -W default -bb -E`` options -- also cross-compilation options, not detailed here\r\n * regrtest: pass ``-r -w -j0 -u all,-largefile,-audio,-gui`` options, add ``-n`` on Windows.\r\n\r\n---\r\n\r\nGitHub Action workflow uses, [.github/workflows/build.yml](https://github.com/python/cpython/blob/afa7b0d743d9b7172d58d1e4c28da8324b9be2eb/.github/workflows/build.yml):\r\n\r\n* Windows x86: ``.\\PCbuild\\rt.bat -p Win32 -d -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0``\r\n* Windows x64: ``.\\PCbuild\\rt.bat -p x64 -d -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0``\r\n* macOS: ``make buildbottest TESTOPTS=\"-j4 -uall,-cpu\"``\r\n* Ubuntu: ``xvfb-run make buildbottest TESTOPTS=\"-j4 -uall,-cpu\"``\r\n* Address Sanitizer: ``xvfb-run make buildbottest TESTOPTS=\"-j4 -uall,-cpu\"``\r\n\r\nBuildbot use, [master/custom/factories.py](https://github.com/python/buildmaster-config/blob/0fbab0b010c8d24145e304505463bdf562439d85/master/custom/factories.py):\r\n\r\n* UnixBuild and UnixCrossBuild: ``make buildbottest TESTOPTS=\"...\" TESTPYTHONOPTS=\"...\" TESTTIMEOUT=\"...\"`` with code to select TESTOPTS, TESTPYTHONOPTS and TESTTIMEOUT.\r\n* UnixInstalledBuild: ``/path/to/python -m test ...`` with code to select ``-m test`` options.\r\n* BaseWindowsBuild: ``Tools\\buildbot\\test.bat ...`` with code to select ``....`` options\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-109567\n* gh-109570\n* gh-109701\n* gh-109909\n* gh-109926\n* gh-109954\n* gh-109969\n* gh-110062\n* gh-110120\n* gh-110121\n* gh-110122\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/vstinner","@type":"Person","name":"vstinner"},"datePublished":"2023-09-19T10:28:13.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/109566/cpython/issues/109566"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:90a68546-10cb-00bd-f8e6-a463f4a64ceb |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 886C:284320:2C287:39D7F:696B3153 |
| html-safe-nonce | e703db2d6f0eab21afa356368a48e19c32d668fcf82d0a37a54d23cb91c5306d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4ODZDOjI4NDMyMDoyQzI4NzozOUQ3Rjo2OTZCMzE1MyIsInZpc2l0b3JfaWQiOiI4MTUzODE1NDA2ODUwMjkwMDAzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 290c4447edad8e86d4d6a854368801fb608d8f49ef9b5c8f92d41bf6ebdf1fa9 |
| hovercard-subject-tag | issue:1902675733 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/109566/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e02ddf6c3bcb06d0544ba8db78542139b806f18eb63cf3e5f9612599efce8ec2/python/cpython/issues/109566 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e02ddf6c3bcb06d0544ba8db78542139b806f18eb63cf3e5f9612599efce8ec2/python/cpython/issues/109566 |
| og:image:alt | There are at least 15 known ways to run the Python test suite. IMO it's too much, it's hard to keep all these code paths consistent. IMO python -m test should be enough to fit all use cases. Maybe ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | vstinner |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 82560a55c6b2054555076f46e683151ee28a19bc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width