From 3c77c106330ca77883e9e3c7a150032bb5db73fd Mon Sep 17 00:00:00 2001
From: Richard Si <sichard26@gmail.com>
Date: Sat, 8 Mar 2025 10:44:32 -0500
Subject: [PATCH] tests: Use script.scratch_path over script.temp_path

script.temp_path is the system temporary directory. scripttest will
check that there aren't any dangling files left in there, thus it's
inappropriate to write long-lived packages there.

These tests are currently passing as scripttest's temporary file
detection logic is broken. However, a newer version of scripttest will
fail.
---
 tests/functional/test_cli.py    | 2 +-
 tests/functional/test_pep517.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/functional/test_cli.py b/tests/functional/test_cli.py
index 65946a1f46a..366d0129b2d 100644
--- a/tests/functional/test_cli.py
+++ b/tests/functional/test_cli.py
@@ -24,7 +24,7 @@ def test_entrypoints_work(entrypoint: str, script: PipTestEnvironment) -> None:
     if script.zipapp:
         pytest.skip("Zipapp does not include entrypoints")
 
-    fake_pkg = script.temp_path / "fake_pkg"
+    fake_pkg = script.scratch_path / "fake_pkg"
     fake_pkg.mkdir()
     fake_pkg.joinpath("setup.py").write_text(
         dedent(
diff --git a/tests/functional/test_pep517.py b/tests/functional/test_pep517.py
index fd9380d0eb6..34ddd6633ce 100644
--- a/tests/functional/test_pep517.py
+++ b/tests/functional/test_pep517.py
@@ -252,7 +252,7 @@ def test_pep517_backend_requirements_satisfied_by_prerelease(
     script.pip("install", "test_backend", "--no-index", "-f", data.backends)
 
     project_dir = make_project(
-        script.temp_path,
+        script.scratch_path,
         requires=["test_backend", "myreq"],
         backend="test_backend",
     )