Skip to content

Conversation

@erooke
Copy link
Contributor

@erooke erooke commented Oct 15, 2025

Changes

To ensure that the same python interpreter is used to spawn pytask as is running the test we currently rely on uv to spawn the instance of python. This relies on us having spawned the test process from uv in the first place and requires that uv be used by anyone attempting to test the software.

This switches the pattern uv run python to call
sys.executable which gives the absolute path of the interpreter being used.

There are three tests left which rely on uv, they all call uv run pytask instead of uv run python -m pytask. I am not sure how best to handle these at the moment:

args = (
"uv",
"run",
"pytask",
"build",
"--hook-module",
"hooks/hooks.py",
"--help",
)

args = ("uv", "run", "--no-project", "pytask", "build", "--help")

result = run_in_subprocess(("uv", "run", "pytask"), cwd=tmp_path)

Todo

  • Reference issues which can be closed due to this PR with "Closes #x".
  • Review whether the documentation needs to be updated.
  • Document PR in docs/source/changes.md.

closes #712

erooke and others added 2 commits October 14, 2025 20:20
To ensure that the same python interpreter is used to spawn pytask as is
running the test we currently rely on `uv` to spawn the instance of
python. This relies on us having spawned the test process from `uv` in
the first place and requires that `uv` be used by anyone attempting to
test the software.

This switches the pattern `uv run python` to call
(`sys.executable`)[https://docs.python.org/3/library/sys.html#sys.executable]
which gives the absolute path of the interpreter being used.
@codecov
Copy link

codecov bot commented Oct 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.19%. Comparing base (ad3680e) to head (c44ab71).
⚠️ Report is 135 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #713      +/-   ##
==========================================
- Coverage   97.80%   97.19%   -0.61%     
==========================================
  Files         106      114       +8     
  Lines        8710     9245     +535     
==========================================
+ Hits         8519     8986     +467     
- Misses        191      259      +68     
Flag Coverage Δ
end_to_end ?
integration ?
unit ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

@tobiasraabe
Copy link
Member

tobiasraabe commented Oct 16, 2025

@erooke, I believe the difference in the two commands does not matter here for me. I am fine with using just the python -m pattern.

Thank you very much for your contribution!

@tobiasraabe tobiasraabe changed the title switch from uv run python to sys.executable Remove uv as a test dependency. Oct 16, 2025
@tobiasraabe tobiasraabe merged commit 74110cb into pytask-dev:main Oct 16, 2025
20 checks passed
@tobiasraabe tobiasraabe added this to the v0.5.6 milestone Oct 31, 2025
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.

QST: Test suite depends on uv

2 participants