Skip to content

Commit 52a365f

Browse files
committed
Catch PermissionError when trying to call perf in tests
Using Ubuntu 24.04 on the Windows Subsystem for Linux, perf will raise a `PermissionError` instead of `FileNotFoundError`. This commit modifies the tests to catch that.
1 parent 3704171 commit 52a365f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Lib/test/test_perf_profiler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ def _is_perf_version_at_least(major, minor):
508508
# a commit hash in the version string, like "6.12.9.g242e6068fd5c"
509509
try:
510510
output = subprocess.check_output(["perf", "--version"], text=True)
511-
except (subprocess.CalledProcessError, FileNotFoundError):
511+
except (subprocess.CalledProcessError, FileNotFoundError, PermissionError):
512512
return False
513513
version = output.split()[2]
514514
version = version.split("-")[0]

0 commit comments

Comments
 (0)