Skip to content

test_perf_profiler is not portable and fails on Windows due to hardcoded /tmp/ paths #141610

@pareshjoshij

Description

@pareshjoshij

Bug report

Bug description:

The test file Lib/test/test_perf_profiler.py is fundamentally non-portable because it hardcodes the /tmp/ directory for all perf-*.map file operations.

This is visible in multiple places, such as:

_cleanup_perf_map(self, pid): unlink(f"/tmp/perf-{pid}.map")

test_trampoline_works: perf_file = pathlib.Path(f"/tmp/perf-{process.pid}.map")

test_trampoline_works_with_forks: perf_file = pathlib.Path(f"/tmp/perf-{process.pid}.map")

This reliance on a hardcoded, Unix-specific path causes two major problems:

Guaranteed Failure on Windows: The test module is completely inoperable on Windows, as this directory does not exist.

Test Coverage Gap: This leaves a significant gap in test coverage, as we cannot validate the perf trampoline features on the Windows platform.

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsTests in the Lib/test dirtopic-profilingtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions