Skip to content

test_expanduser_pwd2 in test_posixpath can be very slow #132185

Closed
@itamaro

Description

@itamaro

Bug report

Bug description:

This test can take many minutes to complete, on systems where pwd.getpwall() might return a very large number of entries.

./python -m test -v test_posixpath -m test_expanduser_pwd2

I don't see any obvious benefit to this test running on literally every single entry.

My proposal is to simply limit the iteration in the test to the first 10 (or any other arbitrary reasonable number) entries (see attached PR).
Another option is to put the test behind some resource to allow skipping it easily without needing to patch.

CPython versions tested on:

CPython main branch, 3.13, 3.12, 3.14

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

Labels

performancePerformance or resource usagetestsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions