|
1 | 1 | import errno
|
| 2 | +import sys |
2 | 3 | from unittest import mock
|
3 | 4 |
|
4 | 5 | import pytest
|
@@ -120,18 +121,34 @@ def test_most_cases(
|
120 | 121 | "Consider checking your local proxy configuration"
|
121 | 122 | ' with "pip config debug".\n',
|
122 | 123 | ),
|
123 |
| - # Testing both long path error (ENOENT) and long file/folder name error (EINVAL) |
124 |
| - ( |
| 124 | + # Testing both long path error (ENOENT) and long file/folder name error (EINVAL) on Windows |
| 125 | + pytest.param( |
125 | 126 | OSError(errno.ENOENT, "No such file or directory", "C:/foo/" + "a" * 261),
|
126 | 127 | False,
|
127 | 128 | False,
|
128 |
| - f"""Could not install packages due to an OSError: [Errno 2] No such file or directory: 'C:/foo/{"a"*261}'\n""", |
| 129 | + "Could not install packages due to an OSError: " |
| 130 | + f"[Errno 2] No such file or directory: 'C:/foo/{'a'*261}'\n" |
| 131 | + "HINT: This error might have occurred since " |
| 132 | + "this system does not have Windows Long Path " |
| 133 | + "support enabled. You can find information on " |
| 134 | + "how to enable this at " |
| 135 | + "https://pip.pypa.io/warnings/enable-long-paths\n", |
| 136 | + marks=pytest.mark.skipif( |
| 137 | + sys.platform != "win32", reason="Windows-specific filename length test" |
| 138 | + ), |
129 | 139 | ),
|
130 |
| - ( |
| 140 | + pytest.param( |
131 | 141 | OSError(errno.EINVAL, "No such file or directory", "C:/foo/" + "a" * 256),
|
132 | 142 | False,
|
133 | 143 | False,
|
134 |
| - f"""Could not install packages due to an OSError: [Errno 22] No such file or directory: 'C:/foo/{"a"*256}'\n""", |
| 144 | + "Could not install packages due to an OSError: " |
| 145 | + f"[Errno 22] No such file or directory: 'C:/foo/{'a'*256}'\n" |
| 146 | + "HINT: This error might be caused by a file or folder name exceeding " |
| 147 | + "255 characters, which is a Windows limitation even if long paths " |
| 148 | + "are enabled.\n", |
| 149 | + marks=pytest.mark.skipif( |
| 150 | + sys.platform != "win32", reason="Windows-specific filename length test" |
| 151 | + ), |
135 | 152 | ),
|
136 | 153 | ],
|
137 | 154 | )
|
|
0 commit comments