Skip to content

Tests using the same machine-wide resource should not run in parallel #156082

Description

@serhiy-storchaka

Feature or enhancement

Some resources which tests use are not per-process: the display, the sound device, the terminal. Two tests using one of them at the same time can interfere with each other, and regrtest runs test files in parallel by default.

Only tests using the same resource conflict. A GUI test can run in parallel with any non-GUI test, so pausing all the other tests would be too much.

These resources are already named on the command line: gui, audio, console and curses. A test declares which one it needs with requires(), requires_resource() or, for the memory, bigmemtest(), so those functions could lock the resource for the duration of the test or of the test file. The ~50 GUI modules, test_winsound, test_curses, test_winconsoleio and the bigmem tests would need no change.

The cost is that such tests no longer overlap each other: running test_tkinter, test_ttk and test_idle with -j4 takes as long as all three together (7.1 s here) instead of as long as the slowest (3.5 s). Tests which use no such resource keep running in parallel with them.

Linked PRs

Activity

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 dirtype-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions