diff --git a/CHANGELOG.md b/CHANGELOG.md index 13dd200c..c54af609 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ releases are available on [PyPI](https://pypi.org/project/pytask) and - {pull}`707` drops support for Python 3.9 as it has reached end of life. - {pull}`708` updates mypy and fixes type issues. - {pull}`709` add uv pre-commit check. +- {pull}`713` removes uv as a test dependency. Closes {issue}`712`. Thanks to {user}`erooke`! ## 0.5.5 - 2025-07-25 diff --git a/tests/test_capture.py b/tests/test_capture.py index ba37be8b..a48c3ca3 100644 --- a/tests/test_capture.py +++ b/tests/test_capture.py @@ -87,7 +87,7 @@ def task_show_capture(): """ tmp_path.joinpath("workflow.py").write_text(textwrap.dedent(source)) - result = run_in_subprocess(("uv", "run", "python", "workflow.py"), cwd=tmp_path) + result = run_in_subprocess((sys.executable, "workflow.py"), cwd=tmp_path) assert result.exit_code == ExitCode.FAILED @@ -128,7 +128,7 @@ def test_wrong_capture_method(tmp_path): """ tmp_path.joinpath("workflow.py").write_text(textwrap.dedent(source)) - result = run_in_subprocess(("uv", "run", "python", "workflow.py"), cwd=tmp_path) + result = run_in_subprocess((sys.executable, "workflow.py"), cwd=tmp_path) assert result.exit_code == ExitCode.CONFIGURATION_FAILED assert "Value 'a' is not a valid" in result.stdout assert "Traceback" not in result.stdout @@ -255,7 +255,7 @@ def task_unicode(): tmp_path.joinpath("workflow.py").write_text( textwrap.dedent(source), encoding="utf-8" ) - result = run_in_subprocess(("uv", "run", "python", "workflow.py"), cwd=tmp_path) + result = run_in_subprocess((sys.executable, "workflow.py"), cwd=tmp_path) assert result.exit_code == ExitCode.OK assert "1 Succeeded" in result.stdout diff --git a/tests/test_config.py b/tests/test_config.py index c46f5edb..418780ff 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -114,7 +114,7 @@ def test_paths_are_relative_to_configuration_file(tmp_path): session = build(paths=[Path("src")]) """ tmp_path.joinpath("script.py").write_text(textwrap.dedent(source)) - result = run_in_subprocess(("uv", "run", "python", "script.py"), cwd=tmp_path) + result = run_in_subprocess((sys.executable, "script.py"), cwd=tmp_path) assert result.exit_code == ExitCode.OK assert "1 Succeeded" in result.stdout diff --git a/tests/test_dag_command.py b/tests/test_dag_command.py index 3ca41baf..d56927fc 100644 --- a/tests/test_dag_command.py +++ b/tests/test_dag_command.py @@ -92,7 +92,7 @@ def main(): tmp_path.joinpath("input.txt").touch() result = subprocess.run( - ("uv", "run", "python", "task_example.py"), + (sys.executable, "task_example.py"), cwd=tmp_path, check=True, capture_output=True, diff --git a/tests/test_execute.py b/tests/test_execute.py index 1a233160..809d0c7e 100644 --- a/tests/test_execute.py +++ b/tests/test_execute.py @@ -25,9 +25,7 @@ def test_python_m_pytask(tmp_path): tmp_path.joinpath("task_module.py").write_text("def task_example(): pass") - result = run_in_subprocess( - ("uv", "run", "python", "-m", "pytask", tmp_path.as_posix()) - ) + result = run_in_subprocess((sys.executable, "-m", "pytask", tmp_path.as_posix())) assert result.exit_code == ExitCode.OK @@ -602,7 +600,7 @@ def create_file( """ tmp_path.joinpath("task_module.py").write_text(textwrap.dedent(source)) result = subprocess.run( - ("uv", "run", "python", tmp_path.joinpath("task_module.py").as_posix()), + (sys.executable, tmp_path.joinpath("task_module.py").as_posix()), check=False, ) assert result.returncode == ExitCode.OK @@ -632,7 +630,7 @@ def task2() -> None: pass """ tmp_path.joinpath("task_module.py").write_text(textwrap.dedent(source)) result = run_in_subprocess( - ("uv", "run", "python", tmp_path.joinpath("task_module.py").as_posix()) + (sys.executable, tmp_path.joinpath("task_module.py").as_posix()) ) assert result.exit_code == ExitCode.OK diff --git a/tests/test_hook_module.py b/tests/test_hook_module.py index eba48680..4b5a75cc 100644 --- a/tests/test_hook_module.py +++ b/tests/test_hook_module.py @@ -1,6 +1,7 @@ from __future__ import annotations import subprocess +import sys import textwrap import pytest @@ -9,8 +10,8 @@ from tests.conftest import run_in_subprocess -@pytest.mark.parametrize("module_name", [True, False]) -def test_add_new_hook_via_cli(tmp_path, module_name): +@pytest.mark.parametrize("hook_location", ["hooks/hooks.py", "hooks.hooks"]) +def test_add_new_hook_via_cli(tmp_path, hook_location): hooks = """ import click from pytask import hookimpl @@ -23,38 +24,24 @@ def pytask_extend_command_line_interface(cli): tmp_path.joinpath("hooks").mkdir() tmp_path.joinpath("hooks", "hooks.py").write_text(textwrap.dedent(hooks)) - if module_name: - args = ( - "uv", - "run", - "python", - "-m", - "pytask", - "build", - "--hook-module", - "hooks.hooks", - "--help", - ) - else: - args = ( - "uv", - "run", - "pytask", - "build", - "--hook-module", - "hooks/hooks.py", - "--help", - ) - + args = ( + sys.executable, + "-m", + "pytask", + "build", + "--hook-module", + hook_location, + "--help", + ) result = run_in_subprocess(args, cwd=tmp_path) assert result.exit_code == ExitCode.OK assert "--new-option" in result.stdout -@pytest.mark.parametrize("module_name", [True, False]) -def test_add_new_hook_via_config(tmp_path, module_name): +@pytest.mark.parametrize("hook_location", ["hooks/hooks.py", "hooks.hooks"]) +def test_add_new_hook_via_config(tmp_path, hook_location): tmp_path.joinpath("pyproject.toml").write_text( - "[tool.pytask.ini_options]\nhook_module = ['hooks/hooks.py']" + f"[tool.pytask.ini_options]\nhook_module = ['{hook_location}']" ) hooks = """ @@ -68,19 +55,7 @@ def pytask_extend_command_line_interface(cli): tmp_path.joinpath("hooks").mkdir() tmp_path.joinpath("hooks", "hooks.py").write_text(textwrap.dedent(hooks)) - if module_name: - args = ( - "uv", - "run", - "--no-project", - "python", - "-m", - "pytask", - "build", - "--help", - ) - else: - args = ("uv", "run", "--no-project", "pytask", "build", "--help") + args = (sys.executable, "-m", "pytask", "build", "--help") result = run_in_subprocess(args, cwd=tmp_path) assert result.exit_code == ExitCode.OK diff --git a/tests/test_task.py b/tests/test_task.py index a2f70ad7..d7294b47 100644 --- a/tests/test_task.py +++ b/tests/test_task.py @@ -667,7 +667,7 @@ def task_second(): tmp_path.joinpath("task_example.py").write_text(textwrap.dedent(source)) result = subprocess.run( - ("uv", "run", "python", "task_example.py"), + (sys.executable, "task_example.py"), cwd=tmp_path, capture_output=True, check=False, diff --git a/tests/test_warnings.py b/tests/test_warnings.py index 88110187..6e551507 100644 --- a/tests/test_warnings.py +++ b/tests/test_warnings.py @@ -1,5 +1,6 @@ from __future__ import annotations +import sys import textwrap import pytest @@ -148,7 +149,7 @@ def warn_now(): path_to_warn_module.write_text(textwrap.dedent(warn_module)) # Cannot use runner since then warnings are not ignored by default. - result = run_in_subprocess(("uv", "run", "pytask"), cwd=tmp_path) + result = run_in_subprocess((sys.executable, "-m", "pytask"), cwd=tmp_path) assert result.exit_code == ExitCode.OK assert "Warnings" not in result.stdout assert "warning!!!" not in result.stdout