Kaynağa Gözat

Attempt to fix build on Windows

Jelmer Vernooij 2 ay önce
ebeveyn
işleme
6c12acf779
1 değiştirilmiş dosya ile 7 ekleme ve 1 silme
  1. 7 1
      tests/test_porcelain.py

+ 7 - 1
tests/test_porcelain.py

@@ -1180,7 +1180,13 @@ class AddTests(PorcelainTestCase):
         """Test adding a symlink with absolute path to system directory."""
         # Create a symlink to a system directory
         symlink_path = os.path.join(self.repo.path, "link_to_tmp")
-        os.symlink("/tmp", symlink_path)
+        if os.name == "nt":
+            # On Windows, use a system directory like TEMP
+            symlink_target = os.environ["TEMP"]
+        else:
+            # On Unix-like systems, use /tmp
+            symlink_target = "/tmp"
+        os.symlink(symlink_target, symlink_path)
 
         # Adding a symlink to a directory outside the repo should raise ValueError
         with self.assertRaises(ValueError) as cm: