Skip to content

Conversation

@stefanor
Copy link
Contributor

Allows tests to pass on Debian package builds where multiple Python 3 versions may be supported at the same time.

From: https://bugs.debian.org/1122001

Allows tests to pass on Debian package builds where multiple Python 3
versions may be supported at the same time.

From: https://bugs.debian.org/1122001
@codecov
Copy link

codecov bot commented Dec 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.28%. Comparing base (60e928f) to head (786e2d7).
⚠️ Report is 23 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #410      +/-   ##
==========================================
+ Coverage   87.56%   90.28%   +2.71%     
==========================================
  Files          18       20       +2     
  Lines        1641     2080     +439     
  Branches      348      447      +99     
==========================================
+ Hits         1437     1878     +441     
- Misses        149      151       +2     
+ Partials       55       51       -4     

see 4 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 630abb0...786e2d7. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@TTsangSC
Copy link
Collaborator

TTsangSC commented Dec 28, 2025

Hi, culprit behind the test you're fixing here. Thanks for catching this corner case.

I'm wondering if it makes sense to factor out all the

r'^Inspect results with:''\n'
r'\Spython\S -m line_profiler .*script\.py\.lprof'

and just do something like

from line_profiler.cli_utils import get_python_executable
from shlex import quote


# See `kernprof.py::_post_profile()`
KERNPROF_INSPECT_RESULT_PROMPT = (
    r'^Inspect results with:''\n'
    f'{quote(get_python_executable())} -m line_profiler '
    r'.*script\.py\.lprof')

and just reuse this constant in the parametrization. Because, as this bug illustrated, we don't really have a guarantee over what the Python executable is called – if isn't already whatever which python or python3 resolves to. In that case, partially replicating the code used by kernprof to write the output line as above seems to be the safest.

That, or we just .+ the executable name.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants