GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Unify ways to run the Python test suite · Issue #109566 · python/cpython

Unify ways to run the Python test suite #109566

New issue
Copy link
New issue
Copy link
Closed
Closed
Unify ways to run the Python test suite#109566
Copy link
Labels
testsTests in the Lib/test dirTests in the Lib/test dir

Description

@vstinner
vstinner
opened on Sep 19, 2023
Issue body actions

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 option which would run tests is "strict" mode.


Portable way to run tests:

./python -m test
./python -m test.regrtest
./python -m test.libregrtest
./python -m test.autotest

./python Lib/test/regrtest.py
./python Lib/test/autotest.py

./python -c 'from test import autotest'

The 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.

Unix, from Python source code:

make buildbottest TESTOPTS="..."
make test
make testall
make testuniversal
make hostrunnertest

./python Tools/scripts/run_tests.py

Windows, from Python source code:

PCbuild\rt.bat
Tools\buildbot\test.bat

  • Lib/test/autotest.py just runs test.libregrtest.main().

  • Lib/test/regrtest.py runs test.libregrtest.main() and remove Lib/test/ from sys.path and make __file__ an absolute path.

  • PCbuild\rt.bat:

    • python: pass -u -Wd -E -bb options
    • regrtest: pass options passed to rt.bat (except of options specific to rt.bat)
    • most options are to get the path to the python.exe program in PCbuild/
  • Tools\buildbot\test.bat runs PCbuild\rt.bat:

    • rt.bat: pass -q -d options.
    • regrtest: pass -j1 -uall -rwW --slowest --timeout=1200 --fail-env-changed options.
    • ARM32 SSH pass -unetwork -udecimal -usubprocess -uurlfetch -utzdata -rwW --slowest --timeout=1200 --fail-env-changed options.
  • make buildbottest runs Tools/scripts/run_tests.py:

    • python: pass $(TESTPYTHONOPTS) options.
    • regrtest: pass -j 1 -u all -W --slowest --fail-env-changed --timeout=$(TESTTIMEOUT) $(TESTOPTS) options.
  • Tools/scripts/run_tests.py:

    • python: pass -u -W default -bb -E options -- also cross-compilation options, not detailed here
    • regrtest: pass -r -w -j0 -u all,-largefile,-audio,-gui options, add -n on Windows.

GitHub Action workflow uses, .github/workflows/build.yml:

  • Windows x86: .\PCbuild\rt.bat -p Win32 -d -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0
  • Windows x64: .\PCbuild\rt.bat -p x64 -d -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0
  • macOS: make buildbottest TESTOPTS="-j4 -uall,-cpu"
  • Ubuntu: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu"
  • Address Sanitizer: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu"

Buildbot use, master/custom/factories.py:

  • UnixBuild and UnixCrossBuild: make buildbottest TESTOPTS="..." TESTPYTHONOPTS="..." TESTTIMEOUT="..." with code to select TESTOPTS, TESTPYTHONOPTS and TESTTIMEOUT.
  • UnixInstalledBuild: /path/to/python -m test ... with code to select -m test options.
  • BaseWindowsBuild: Tools\buildbot\test.bat ... with code to select .... options

Linked PRs

  • gh-109566: Run buildbot tests with --fail-rerun #109567
  • gh-109566, regrtest: Add --fast-ci and --slow-ci options #109570
  • gh-109566: Fix typo in PCbuild/rt.bat #109701
  • gh-109566: regrtest reexecutes the process #109909
  • gh-109566: Fix regrtest code adding Python options #109926
  • gh-109566: Fix regrtest Python options for WASM/WASI #109954
  • gh-109566: regrtest doesn't enable --rerun if --python is used #109969
  • gh-109566: regrtest _add_python_opts() handles KeyboardInterrupt #110062
  • gh-109566: PCbuild/rt.bat now uses --fast-ci #110120
  • gh-109566: regrtest --fast-ci no longer enables --nowindow #110121
  • gh-109566: Remove make testall #110122
Reacted by JosephSBoyle

Activity

Next
  1. vstinner
    added 6 commits that reference this issue on Sep 19, 2023

    pythongh-109566: Run buildbot tests with --fail-rerun

    8dd5a56

    pythongh-109566, regrtest: Add --fast-ci and --slow-ci options

    bed5a77

    pythongh-109566, regrtest: Add --fast-ci and --slow-ci options

    e6fd818

    pythongh-109566, regrtest: Add --fast-ci and --slow-ci options

    fefb208

    pythongh-109566, regrtest: Add --fast-ci and --slow-ci options

    dbbdc26

    gh-109566: Run GHA and buildbot tests with --fail-rerun (#109567)

    67d9363
  2. vstinner
    added
    testsTests in the Lib/test dirTests in the Lib/test dir
    on Sep 20, 2023
  3. vstinner
    added 8 commits that reference this issue on Sep 22, 2023

    pythongh-109566: Fix typo in PCbuild/rt.bat

    5d1c46f

    gh-109566: Fix typo in PCbuild/rt.bat (#109701)

    3cce6be

    pythongh-109566, regrtest: Add --fast-ci and --slow-ci options

    70d1c17

    pythongh-109566, regrtest: Add --fast-ci and --slow-ci options

    a24c755

    pythongh-109566, regrtest: Add --fast-ci and --slow-ci options

    699a0dd

    pythongh-109566, regrtest: Add --fast-ci and --slow-ci options

    cf59c92

    pythongh-109566, regrtest: Add --fast-ci and --slow-ci options

    be4c7be

    gh-109566, regrtest: Add --fast-ci and --slow-ci options (#109570)

    859618c
  4. 31 remaining items

  5. vstinner
    added 5 commits that reference this issue on Sep 29, 2023

    pythongh-109566: regrtest --fast-ci no longer enables --nowindow

    6efcff1

    pythongh-109566: Remove make testall

    8725c01

    gh-109566: PCbuild/rt.bat now uses --fast-ci (#110120)

    f3df8fa

    gh-109566: Remove make testall (#110122)

    9c91141

    gh-109566: regrtest --fast-ci no longer enables --nowindows (#110121)

    5ae6c6d
  6. Glyphack
    added 10 commits that reference this issue on Sep 2, 2024

    pythongh-109566: Fix typo in PCbuild/rt.bat (python#109701)

    4d56535

    pythongh-109566, regrtest: Add --fast-ci and --slow-ci options (pytho…

    693a65b

    pythongh-109566: regrtest reexecutes the process (python#109909)

    48a50c9

    pythongh-109566: Fix regrtest code adding Python options (python#109926)

    8c9872c

    pythongh-109566: Fix regrtest Python options for WASM/WASI (python#10…

    7ffa11f

    pythongh-109566: regrtest doesn't enable --rerun if --python is used (p…

    676ae9a

    pythongh-109566: regrtest _add_python_opts() handles KeyboardInterrupt (

    262be29

    pythongh-109566: PCbuild/rt.bat now uses --fast-ci (python#110120)

    3dc9aa1

    pythongh-109566: Remove make testall (python#110122)

    f3ec973

    pythongh-109566: regrtest --fast-ci no longer enables --nowindows (py…

    421d151
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsTests in the Lib/test dirTests in the Lib/test dir

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.