Skip to content

Commit 3d984a1

Browse files
authored
compileall tests: Use shorter name for long_path test (GH-16419)
Apparently, the path needs to be limited to 260 characters on (some versions of) Windows.
1 parent 4f2eac0 commit 3d984a1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Lib/test/test_compileall.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def create_long_path(self):
5353
# It will be 100 directories deep, or shorter if the OS limits it.
5454
for i in range(10):
5555
longer_path = os.path.join(
56-
long_path, *(f"long_directory_{i}_{j}" for j in range(10))
56+
long_path, *(f"dir_{i}_{j}" for j in range(10))
5757
)
5858

5959
# Check if we can open __pycache__/*.pyc.
@@ -87,8 +87,12 @@ def create_long_path(self):
8787
long_source = longer_source
8888
long_cache = longer_cache
8989

90+
# On Windows, MAX_PATH is 260 characters, our path with the 20
91+
# directories is 160 characters long, leaving something for the
92+
# root (self.directory) as well.
93+
# Tests assume long_path contains at least 10 directories.
9094
if i < 2:
91-
raise ValueError('Path limit is too short')
95+
raise ValueError(f'"Long path" is too short: {long_path}')
9296

9397
self.source_path_long = long_source
9498
self.bc_path_long = long_cache

0 commit comments

Comments
 (0)