|
20 | 20 | from pytask import build |
21 | 21 | from pytask import cli |
22 | 22 | from tests.conftest import enter_directory |
| 23 | +from tests.conftest import run_in_subprocess |
23 | 24 |
|
24 | 25 |
|
25 | | -@pytest.mark.xfail(sys.platform == "win32", reason="See #293.") |
26 | 26 | @pytest.mark.end_to_end |
27 | 27 | def test_python_m_pytask(tmp_path): |
28 | 28 | tmp_path.joinpath("task_module.py").write_text("def task_example(): pass") |
29 | | - subprocess.run(["python", "-m", "pytask", tmp_path.as_posix()], check=False) |
| 29 | + result = run_in_subprocess( |
| 30 | + ("uv", "run", "python", "-m", "pytask", tmp_path.as_posix()) |
| 31 | + ) |
| 32 | + assert result.exit_code == ExitCode.OK |
30 | 33 |
|
31 | 34 |
|
32 | 35 | @pytest.mark.end_to_end |
@@ -657,10 +660,10 @@ def task2() -> None: pass |
657 | 660 | sys.exit(session2.exit_code) |
658 | 661 | """ |
659 | 662 | tmp_path.joinpath("task_module.py").write_text(textwrap.dedent(source)) |
660 | | - result = subprocess.run( |
661 | | - ("python", tmp_path.joinpath("task_module.py").as_posix()), check=False |
| 663 | + result = run_in_subprocess( |
| 664 | + ("uv", "run", "python", tmp_path.joinpath("task_module.py").as_posix()) |
662 | 665 | ) |
663 | | - assert result.returncode == ExitCode.OK |
| 666 | + assert result.exit_code == ExitCode.OK |
664 | 667 |
|
665 | 668 |
|
666 | 669 | @pytest.mark.end_to_end |
@@ -765,14 +768,14 @@ def task_example() -> Annotated[str, Path("file.txt")]: |
765 | 768 | """ |
766 | 769 | tmp_path.joinpath("task_example.py").write_text(textwrap.dedent(source)) |
767 | 770 |
|
768 | | - result = subprocess.run(("pytask"), cwd=tmp_path) # noqa: PLW1510 |
769 | | - assert result.returncode == ExitCode.OK |
| 771 | + result = run_in_subprocess(("pytask",), cwd=tmp_path) |
| 772 | + assert result.exit_code == ExitCode.OK |
770 | 773 |
|
771 | 774 | hashes = json.loads(tmp_path.joinpath(".pytask", "file_hashes.json").read_text()) |
772 | 775 | assert len(hashes) == 2 |
773 | 776 |
|
774 | | - result = subprocess.run(("pytask"), cwd=tmp_path) # noqa: PLW1510 |
775 | | - assert result.returncode == ExitCode.OK |
| 777 | + result = run_in_subprocess(("pytask",), cwd=tmp_path) |
| 778 | + assert result.exit_code == ExitCode.OK |
776 | 779 |
|
777 | 780 | hashes_ = json.loads(tmp_path.joinpath(".pytask", "file_hashes.json").read_text()) |
778 | 781 | assert hashes == hashes_ |
|
0 commit comments